Class DependencyClassLoader
java.lang.Object
java.lang.ClassLoader
java.security.SecureClassLoader
java.net.URLClassLoader
de.craftsblock.craftsnet.addon.loaders.CraftsNetClassLoader
de.craftsblock.craftsnet.addon.loaders.DependencyClassLoader
- All Implemented Interfaces:
Closeable,AutoCloseable
Class responsible for loading dependencies dynamically into the CraftsNet framework.
- Since:
- 3.4.3
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic Set<DependencyClassLoader>Get a list of allDependencyClassLoaderwhich are currently active.getUrl()Retrieves theURLwhich thisDependencyClassLoaderloads classes from.protected Class<?>Loads the class with the specified name, optionally linking it after loading.static DependencyClassLoaderCreates a newDependencyClassLoaderfor a specificURL.Methods inherited from class de.craftsblock.craftsnet.addon.loaders.CraftsNetClassLoader
getCraftsNet, isCraftsNetLoaded, isCraftsNetLoaded, retrieveCraftsNet, retrieveCraftsNetMethods 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
-
Method Details
-
loadClass
Loads the class with the specified name, optionally linking it after loading.- Overrides:
loadClassin classClassLoader- Parameters:
name- The binary name of the class to be loaded.resolve-trueto resolve the class;falseto skip resolution.- Returns:
- The
Classobject representing the loaded class. - Throws:
ClassNotFoundException- If the class could not be found.
-
getUrl
Retrieves theURLwhich thisDependencyClassLoaderloads classes from.- Returns:
- The source
URL.
-
getDependenciesLoaders
Get a list of allDependencyClassLoaderwhich are currently active.- Returns:
- The set of
DependencyClassLoader.
-
safelyNew
Creates a newDependencyClassLoaderfor a specificURL. If aDependencyClassLoadermatching theURLalready exists, no newDependencyClassLoaderis created and the existing one is returned.- Parameters:
craftsNet- The instance ofCraftsNetwhich creates theDependencyClassLoader.url- TheURLcontaining the content of the dependency.- Returns:
- An
DependencyClassLoaderwrapping the specificURL.
-