public class InjectionClassLoader
extends java.net.URLClassLoader
Classes by using a custom ClassLoader| Constructor and Description |
|---|
InjectionClassLoader(TransformerManager transformerManager,
java.lang.ClassLoader parent,
java.net.URL... urls) |
InjectionClassLoader(TransformerManager transformerManager,
java.net.URL... urls) |
| Modifier and Type | Method and Description |
|---|---|
void |
addProtectedPackage(java.lang.String protectedPackage)
Add a protected package to prevent the classes from being transformed
|
void |
addRuntimeResource(java.lang.String path,
byte[] data)
Add a new resource to the classpath during runtime
|
void |
addURL(java.net.URL url)
Add an
URL to the classpath |
void |
copyClass(IClassProvider classProvider,
java.lang.String className)
Copy a
Class to this InjectionClassLoader |
void |
copyResource(java.lang.ClassLoader classLoader,
java.lang.String path)
Copy a resource from a
ClassLoader to this InjectionClassLoader |
void |
executeMain(java.lang.String className,
java.lang.String methodName,
java.lang.String... args)
Execute the main method of the given
Class |
protected java.lang.Class<?> |
findClass(java.lang.String name) |
java.net.URL |
findResource(java.lang.String name) |
java.util.Enumeration<java.net.URL> |
findResources(java.lang.String name) |
java.net.URL |
getResource(java.lang.String name) |
TransformerManager |
getTransformerManager()
Get the
TransformerManager used by this InjectionClassLoader |
protected java.lang.Class<?> |
loadClass(java.lang.String name,
boolean resolve) |
void |
setPriority(EnumLoaderPriority priority)
Set the priority of the load class method
|
close, definePackage, getPermissions, getResourceAsStream, getURLs, newInstance, newInstanceclearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getClassLoadingLock, getPackage, getPackages, getParent, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSignerspublic InjectionClassLoader(TransformerManager transformerManager, java.net.URL... urls)
public InjectionClassLoader(TransformerManager transformerManager, java.lang.ClassLoader parent, java.net.URL... urls)
protected java.lang.Class<?> loadClass(java.lang.String name,
boolean resolve)
throws java.lang.ClassNotFoundException
loadClass in class java.lang.ClassLoaderjava.lang.ClassNotFoundExceptionprotected java.lang.Class<?> findClass(java.lang.String name)
throws java.lang.ClassNotFoundException
findClass in class java.net.URLClassLoaderjava.lang.ClassNotFoundExceptionpublic java.net.URL getResource(java.lang.String name)
getResource in class java.lang.ClassLoaderpublic java.net.URL findResource(java.lang.String name)
findResource in class java.net.URLClassLoaderpublic java.util.Enumeration<java.net.URL> findResources(java.lang.String name)
throws java.io.IOException
findResources in class java.net.URLClassLoaderjava.io.IOExceptionpublic void addProtectedPackage(java.lang.String protectedPackage)
protectedPackage - The package to protectpublic TransformerManager getTransformerManager()
TransformerManager used by this InjectionClassLoaderpublic void addURL(java.net.URL url)
URL to the classpathaddURL in class java.net.URLClassLoaderurl - The URL to addpublic void addRuntimeResource(java.lang.String path,
byte[] data)
path - The path to the resourcedata - The data of the resourcepublic void copyResource(java.lang.ClassLoader classLoader,
java.lang.String path)
ClassLoader to this InjectionClassLoaderclassLoader - The ClassLoader to copy the resource frompath - The path to the resourcepublic void copyClass(IClassProvider classProvider, java.lang.String className)
Class to this InjectionClassLoaderclassProvider - The IClassProvider providing the Class to copyclassName - The name of the Class to copypublic void setPriority(EnumLoaderPriority priority)
priority - The prioritypublic void executeMain(java.lang.String className,
java.lang.String methodName,
java.lang.String... args)
throws java.lang.ClassNotFoundException,
java.lang.NoSuchMethodException,
java.lang.reflect.InvocationTargetException,
java.lang.IllegalAccessException
ClassclassName - The name of the Class containing the main methodmethodName - The name of the main methodargs - The arguments to pass to the main methodjava.lang.ClassNotFoundException - If the Class is not foundjava.lang.NoSuchMethodException - If the main method is not foundjava.lang.reflect.InvocationTargetException - If the main method throws an exceptionjava.lang.IllegalAccessException - If the main method is not accessible