From 6aa9225eee699816cd0d1932f7a253896d103d15 Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Fri, 28 Jul 2017 14:32:27 -0700 Subject: [PATCH] Comment class finder. --- src/org/nwapw/abacus/plugin/ClassFinder.java | 25 ++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/org/nwapw/abacus/plugin/ClassFinder.java b/src/org/nwapw/abacus/plugin/ClassFinder.java index 521b55e..a266ea8 100644 --- a/src/org/nwapw/abacus/plugin/ClassFinder.java +++ b/src/org/nwapw/abacus/plugin/ClassFinder.java @@ -17,10 +17,24 @@ import java.util.stream.Collectors; */ public class ClassFinder { + /** + * Loads all the plugin classes from the given plugin folder. + * @param filePath the path for the plugin folder. + * @return the list of all loaded classes. + * @throws IOException thrown if an error occurred scanning the plugin folder. + * @throws ClassNotFoundException thrown if the class listed in the file doesn't get loaded. + */ public static ArrayList> loadJars(String filePath) throws IOException, ClassNotFoundException { return loadJars(new File(filePath)); } + /** + * Loads all the plugin classes from the given plugin folder. + * @param pluginFolderPath the folder in which to look for plugins. + * @return the list of all loaded classes. + * @throws IOException thrown if an error occurred scanning the plugin folder. + * @throws ClassNotFoundException thrown if the class listed in the file doesn't get loaded. + */ public static ArrayList> loadJars(File pluginFolderPath) throws IOException, ClassNotFoundException { ArrayList> toReturn = new ArrayList<>(); if(!pluginFolderPath.exists()) return toReturn; @@ -34,10 +48,13 @@ public class ClassFinder { return toReturn; } - public static ArrayList> loadJar(String path) throws IOException, ClassNotFoundException { - return loadJar(new File(path)); - } - + /** + * Loads the classes from a single path, given by the file. + * @param jarLocation the location of the jar to load. + * @return the list of loaded classes loaded from the jar. + * @throws IOException thrown if there was an error reading the file + * @throws ClassNotFoundException thrown if the class could not be loaded. + */ public static ArrayList> loadJar(File jarLocation) throws IOException, ClassNotFoundException { ArrayList> loadedClasses = new ArrayList<>(); String path = jarLocation.getPath();