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
ConstructorDescriptionExpansionClassLoader
(@NotNull ExpansionManager manager, @NotNull File file, @NotNull ExpansionDescription description, @NotNull ClassLoader parent) Create a new class loader -
Method Summary
Modifier and TypeMethodDescription@NotNull ExpansionDescription
Get the expansion's description@NotNull Expansion
Get the expansionGet the expansion if it's initialized@NotNull File
getFile()
Get the expansion jar@NotNull ExpansionManager
Get the expansion manager@NotNull ExpansionState
getState()
Get the state of the expansion@Nullable Throwable
Get the throwable if the expansion is inExpansionState.ERROR
protected Class<?>
void
setThrowable
(@NotNull Throwable throwable) Set the throwable if the expansion is inExpansionState.ERROR
Methods inherited from class java.net.URLClassLoader
addURL, close, definePackage, findClass, findResource, findResources, getPermissions, getResourceAsStream, getURLs, newInstance, newInstance
Methods inherited from class java.security.SecureClassLoader
defineClass, defineClass
Methods 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:
loadClass
in classClassLoader
- Throws:
ClassNotFoundException
-