Class ExpansionClassLoader
java.lang.Object
java.lang.ClassLoader
java.security.SecureClassLoader
java.net.URLClassLoader
me.hsgamer.hscore.expansion.common.ExpansionClassLoader
- All Implemented Interfaces:
Closeable,AutoCloseable
The class loader of the expansion
-
Constructor Summary
ConstructorsConstructorDescriptionExpansionClassLoader(@NotNull ExpansionManager manager, @NotNull File file, @NotNull ExpansionDescription description, @NotNull ClassLoader parent) Create a new class loader -
Method Summary
Modifier and TypeMethodDescription@NotNull ExpansionDescriptionGet the expansion's description@NotNull ExpansionGet the expansionGet the expansion if it's initialized@NotNull FilegetFile()Get the expansion jar@NotNull ExpansionManagerGet the expansion manager@NotNull ExpansionStategetState()Get the state of the expansion@Nullable ThrowableGet the throwable if the expansion is inExpansionState.ERRORprotected Class<?> voidsetThrowable(@NotNull Throwable throwable) Set the throwable if the expansion is inExpansionState.ERRORMethods inherited from class java.net.URLClassLoader
addURL, close, definePackage, findClass, findResource, findResources, getPermissions, getResourceAsStream, getURLs, newInstance, newInstanceMethods inherited from class java.security.SecureClassLoader
defineClass, defineClassMethods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getResource, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
Constructor Details
-
ExpansionClassLoader
public ExpansionClassLoader(@NotNull @NotNull ExpansionManager manager, @NotNull @NotNull File file, @NotNull @NotNull ExpansionDescription description, @NotNull @NotNull ClassLoader parent) throws MalformedURLException Create a new class loader- Parameters:
manager- the expansion managerfile- the expansion jardescription- the description for the expansionparent- the parent class loader- Throws:
MalformedURLException- if it cannot convert the file to its related URL
-
-
Method Details
-
getExpansionOptional
Get the expansion if it's initialized- Returns:
- the optional expansion
-
getExpansion
Get the expansion- Returns:
- the expansion
- Throws:
IllegalStateException- if the expansion is not found or not initialized
-
getFile
Get the expansion jar- Returns:
- the expansion jar
-
getManager
Get the expansion manager- Returns:
- the expansion manager
-
getDescription
Get the expansion's description- Returns:
- the description
-
getState
Get the state of the expansion- Returns:
- the state
-
getThrowable
Get the throwable if the expansion is inExpansionState.ERROR- Returns:
- the throwable
-
setThrowable
Set the throwable if the expansion is inExpansionState.ERROR- Parameters:
throwable- the throwable
-
loadClass
- Overrides:
loadClassin classClassLoader- Throws:
ClassNotFoundException
-