Package me.hsgamer.hscore.addon.object
Class AddonClassLoader
java.lang.Object
java.lang.ClassLoader
java.security.SecureClassLoader
java.net.URLClassLoader
me.hsgamer.hscore.addon.object.AddonClassLoader
- All Implemented Interfaces:
Closeable,AutoCloseable
The class loader of the addon
-
Constructor Summary
ConstructorsConstructorDescriptionAddonClassLoader(@NotNull AddonManager addonManager, @NotNull File file, @NotNull AddonDescription addonDescription, @NotNull ClassLoader parent) Create an Addon Class Loader -
Method Summary
Modifier and TypeMethodDescriptionprotected @NotNull Class<?>@Nullable Class<?>Get class by the name@NotNull AddongetAddon()Get the addon@NotNull AddonDescriptionGet the addon's description@NotNull AddonManagerGet the addon manager@NotNull FilegetFile()Get the addon jarMethods inherited from class java.net.URLClassLoader
addURL, close, definePackage, 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, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
Constructor Details
-
AddonClassLoader
public AddonClassLoader(@NotNull @NotNull AddonManager addonManager, @NotNull @NotNull File file, @NotNull @NotNull AddonDescription addonDescription, @NotNull @NotNull ClassLoader parent) throws MalformedURLException, IllegalAccessException, InvocationTargetException, InstantiationException, NoSuchMethodException, ClassNotFoundException Create an Addon Class Loader- Parameters:
addonManager- the addon managerfile- the addon jaraddonDescription- the description for the addonparent- the parent class loader- Throws:
MalformedURLException- if it cannot convert the file to its related URLIllegalAccessException- if it cannot create an instance of the main class of the addonInvocationTargetException- if the constructor throws an exceptionInstantiationException- if the main class is an abstract classNoSuchMethodException- if it cannot find the constructorClassNotFoundException- if the main class is not found
-
-
Method Details
-
getAddon
Get the addon- Returns:
- the addon
-
findClass
Get class by the name- Parameters:
name- the class nameglobal- whether it'll try to search globally- Returns:
- the class, or null if it's not found
-
getFile
Get the addon jar- Returns:
- the addon jar
-
getAddonManager
Get the addon manager- Returns:
- the addon manager
-
getAddonDescription
Get the addon's description- Returns:
- the description
-
findClass
@NotNull protected @NotNull Class<?> findClass(@NotNull @NotNull String name) throws ClassNotFoundException - Overrides:
findClassin classURLClassLoader- Throws:
ClassNotFoundException
-