Package kilim
Class WeavingClassLoader
java.lang.Object
java.lang.ClassLoader
kilim.KilimClassLoader
kilim.WeavingClassLoader
Classloader that loads classes from the classpath spec given by the system property
"kilim.class.path" and weaves them dynamically.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final HashMap<URL, ProtectionDomain> private WeavingClassLoader.Excludablestatic final String(package private) ClassLoader(package private) static ClassLoader(package private) URLClassLoader(package private) Weaver -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionClass<?> private ClassdefineAll(String name, ClassWeaver cw) exclude(WeavingClassLoader.Excludable exclude) replace the exclude filter which determines whether a named class should be defined definitively by this loader or instead delegated to the parent loader.protected Class<?> static byte[]findCode(ClassLoader loader, String name) read bytecode for the named class from a source classloaderprivate ProtectionDomainstatic InputStreamgetByteStream(ClassLoader cl, String name, String cname, boolean system) private static URLClassLoadergetProxy()getResourceAsStream(String cname) static URL[]Class<?> static StringmakeResourceName(String name) convert a fully qualified class name to a resource name.private booleanstatic byte[]readFully(InputStream is) static byte[]voidrun static method className.method(args) using reflection and this WeavingClassLoaderstatic StringunmakeResourceName(String cname) weaveClass(String name) load the bytecode for a class of a given name from the classpath and weave itMethods inherited from class kilim.KilimClassLoader
isLoadedMethods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResource, findResources, 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
-
KILIM_CLASSPATH
- See Also:
-
weaver
Weaver weaver -
proxy
URLClassLoader proxy -
pcl
ClassLoader pcl -
platform
-
checker
-
cache
-
-
Constructor Details
-
WeavingClassLoader
public WeavingClassLoader() -
WeavingClassLoader
-
-
Method Details
-
readFully
-
getResourceAsStream
- Overrides:
getResourceAsStreamin classClassLoader
-
getURLs
-
getProxy
-
run
run static method className.method(args) using reflection and this WeavingClassLoader- Throws:
Exception
-
exclude
replace the exclude filter which determines whether a named class should be defined definitively by this loader or instead delegated to the parent loader. this is sometimes necessary to work with classes that may have been previously loaded, eg because they were used as a java agent- Parameters:
exclude- the filter to run- Returns:
-
loadClass
- Overrides:
loadClassin classClassLoader- Throws:
ClassNotFoundException
-
proxy
-
defineAll
-
getByteStream
-
weaveClass
load the bytecode for a class of a given name from the classpath and weave it- Parameters:
name- the fully qualified class name- Returns:
- the weaver
-
findClass
- Overrides:
findClassin classClassLoader- Throws:
ClassNotFoundException
-
get
-
define
-
makeResourceName
convert a fully qualified class name to a resource name. Note: the Class and ClassLoader javadocs don't explicitly specify the string formats used for the various methods, so this conversion is potentially fragile- Parameters:
name- as returned by Class.getName- Returns:
- the name in a format suitable for use with the various ClassLoader.getResource methods
-
unmakeResourceName
-
findCode
read bytecode for the named class from a source classloader- Parameters:
loader- the classloader to get the bytecode from, or null for the current classloadername- the internal name for the class as would be passed to loadClass- Returns:
- a new instance, or null if the bytecode is not found
-
url
-
readFully
- Throws:
IOException
-