Package org.skriptlang.skript.util
Class ClassLoader
java.lang.Object
org.skriptlang.skript.util.ClassLoader
A utility class for loading classes contained in specific packages.
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic ClassLoader.Builder
builder()
void
loadClasses
(Class<?> source) Loads all classes (from the provided source) meeting the criteria set by this loader.void
loadClasses
(Class<?> source, File jarFile) Loads all classes (from the provided source) meeting the criteria set by this loader.static void
loadClasses
(Class<?> source, File jarFile, String basePackage, String... subPackages) A utility method for loading and initializing all classes within the base package/subpackages.void
loadClasses
(Class<?> source, @Nullable JarFile jar) Loads all classes (from the provided source) meeting the criteria set by this loader.
-
Method Details
-
builder
- Returns:
- A builder for creating a loader.
-
loadClasses
public static void loadClasses(Class<?> source, File jarFile, String basePackage, String... subPackages) A utility method for loading and initializing all classes within the base package/subpackages. This method will perform a deep search, meaning classes within subpackages of subpackages will be initialized too.- Parameters:
source
- A class within the resource classes should be loaded from.jarFile
- A file representing the jar to search for classes.basePackage
- The package within the jar to load classes from.subPackages
- The specific subpackages withinbasePackage
to load. If not provided, classes withinbasePackage
and all of its subpackages will be loaded.
-
loadClasses
Loads all classes (from the provided source) meeting the criteria set by this loader. It is recommended to use one of the methods that also accept a [jar] file (loadClasses(Class, File)
andloadClasses(Class, JarFile)
) for increased reliability.- Parameters:
source
- A class within the resource classes should be loaded from.
-
loadClasses
Loads all classes (from the provided source) meeting the criteria set by this loader.- Parameters:
source
- A class within the resource classes should be loaded from.jarFile
- A file representing the jar to search for classes. While it is possible to load the classes without a jar, it is recommended to provide one for reliability.- See Also:
-
loadClasses
Loads all classes (from the provided source) meeting the criteria set by this loader.- Parameters:
source
- A class within the resource classes should be loaded from.jar
- A jar to search for classes. While it is possible to load the classes without this jar, it is recommended to provide one for reliability.- See Also:
-