mirror of
https://github.com/DanilaFe/abacus
synced 2024-09-05 23:37:09 -07:00
Comment class finder.
This commit is contained in:
parent
0592200961
commit
6aa9225eee
|
@ -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<Class<?>> 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<Class<?>> loadJars(File pluginFolderPath) throws IOException, ClassNotFoundException {
|
||||
ArrayList<Class<?>> toReturn = new ArrayList<>();
|
||||
if(!pluginFolderPath.exists()) return toReturn;
|
||||
|
@ -34,10 +48,13 @@ public class ClassFinder {
|
|||
return toReturn;
|
||||
}
|
||||
|
||||
public static ArrayList<Class<?>> 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<Class<?>> loadJar(File jarLocation) throws IOException, ClassNotFoundException {
|
||||
ArrayList<Class<?>> loadedClasses = new ArrayList<>();
|
||||
String path = jarLocation.getPath();
|
||||
|
|
Loading…
Reference in New Issue
Block a user