Package org.openstreetmap.josm.plugins
Class PluginClassLoader
java.lang.Object
java.lang.ClassLoader
java.security.SecureClassLoader
java.net.URLClassLoader
org.openstreetmap.josm.plugins.DynamicURLClassLoader
org.openstreetmap.josm.plugins.PluginClassLoader
- All Implemented Interfaces:
Closeable,AutoCloseable
Class loader for JOSM plugins.
In addition to the classes in the plugin jar file, it loads classes of required plugins. The JOSM core classes should be provided by the parent class loader.
- Since:
- 12322
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPluginClassLoader(URL[] urls, ClassLoader parent, Collection<PluginClassLoader> dependencies) Create a new PluginClassLoader. -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddDependency(PluginClassLoader dependency) Add class loader of a required plugin.private Class<?>findClassInDependencies(String name, boolean resolve) Try to find the specified class in this classes dependenciesfindResource(String name) protected Class<?>toString()Methods inherited from class org.openstreetmap.josm.plugins.DynamicURLClassLoader
addURLMethods inherited from class java.net.URLClassLoader
close, definePackage, findClass, 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
-
Field Details
-
dependencies
-
-
Constructor Details
-
PluginClassLoader
public PluginClassLoader(URL[] urls, ClassLoader parent, Collection<PluginClassLoader> dependencies) Create a new PluginClassLoader.- Parameters:
urls- URLs of the plugin jar file (and extra libraries)parent- the parent class loader (for JOSM core classes)dependencies- class loaders of required plugin; can be null
-
-
Method Details
-
addDependency
Add class loader of a required plugin. This plugin will have access to the classes of the dependent plugin- Parameters:
dependency- the class loader of the required plugin- Returns:
trueif the collection of dependencies changed as a result of the call- Since:
- 12867
-
loadClass
- Overrides:
loadClassin classClassLoader- Throws:
ClassNotFoundException
-
findClassInDependencies
Try to find the specified class in this classes dependencies- Parameters:
name- The name of the class to findresolve-trueto resolve the class- Returns:
- the class, if found, otherwise
null
-
findResource
- Overrides:
findResourcein classURLClassLoader
-
toString
-