public interface ClassLoaderResolver
Modifier and Type | Method and Description |
---|---|
Class |
classForName(String name)
Class loading method.
|
Class |
classForName(String name,
boolean initialize)
Class loading method, allowing for initialisation of the class.
|
Class |
classForName(String name,
ClassLoader primary)
Class loading method, allowing specification of a primary loader.
|
Class |
classForName(String name,
ClassLoader primary,
boolean initialize)
Class loading method, allowing specification of a primary loader
and whether the class should be initialised or not.
|
URL |
getResource(String resourceName,
ClassLoader primary)
Finds the resource with the given name.
|
Enumeration<URL> |
getResources(String resourceName,
ClassLoader primary)
Finds all the resources with the given name.
|
boolean |
isAssignableFrom(Class class_1,
String class_name_2)
Method to test whether the type represented by the specified class_name_2
parameter can be converted to the type represented by class_1 parameter.
|
boolean |
isAssignableFrom(String class_name_1,
Class class_2)
Method to test whether the type represented by the specified class_2
parameter can be converted to the type represented by class_name_1 parameter.
|
boolean |
isAssignableFrom(String class_name_1,
String class_name_2)
Method to test whether the type represented by the specified class_name_2
parameter can be converted to the type represented by class_name_1 parameter.
|
void |
registerUserClassLoader(ClassLoader loader)
ClassLoader registered by users to load classes.
|
void |
setPrimary(ClassLoader primary)
Sets the primary classloader for the current thread.
|
void |
setRuntimeClassLoader(ClassLoader loader)
ClassLoader registered to load classes created at runtime.
|
void |
unsetPrimary()
Unsets the primary classloader for the current thread
|
Class classForName(String name, ClassLoader primary)
name
- Name of the Class to be loadedprimary
- the primary ClassLoader to use (or null)Class classForName(String name, ClassLoader primary, boolean initialize)
name
- Name of the Class to be loadedprimary
- the primary ClassLoader to use (or null)initialize
- whether to initialize the class or not.Class classForName(String name)
name
- Name of the Class to be loadedClass classForName(String name, boolean initialize)
name
- Name of the Class to be loadedinitialize
- whether to initialize the class or not.boolean isAssignableFrom(String class_name_1, Class class_2)
class_name_1
- Class nameclass_2
- Class to compare againstboolean isAssignableFrom(Class class_1, String class_name_2)
class_1
- First classclass_name_2
- Class name to compare againstboolean isAssignableFrom(String class_name_1, String class_name_2)
class_name_1
- Class nameclass_name_2
- Class name to compare againstEnumeration<URL> getResources(String resourceName, ClassLoader primary) throws IOException
resourceName
- the resource name. If resourceName
starts with "/", remove it before searching.primary
- the primary ClassLoader to use (or null)IOException
- If I/O errors occurClassLoader.getResources(java.lang.String)
URL getResource(String resourceName, ClassLoader primary)
resourceName
- the path to resource name relative to the classloader root path. If resourceName
starts with "/", remove it.primary
- the primary ClassLoader to use (or null)ClassLoader.getResource(java.lang.String)
void setRuntimeClassLoader(ClassLoader loader)
loader
.loader
- The ClassLoader in which classes are definedvoid registerUserClassLoader(ClassLoader loader)
loader
.loader
- The ClassLoader in which classes are loadedvoid setPrimary(ClassLoader primary)
primary
- the primary classloadervoid unsetPrimary()
Copyright © 2019. All rights reserved.