public static class ClassFileLocator.ForClassLoader extends Object implements ClassFileLocator
Modifier and Type | Class and Description |
---|---|
static class |
ClassFileLocator.ForClassLoader.WeaklyReferenced
A class file locator that queries a class loader for binary representations of class files.
|
ClassFileLocator.AgentBased, ClassFileLocator.Compound, ClassFileLocator.ForClassLoader, ClassFileLocator.ForFolder, ClassFileLocator.ForJarFile, ClassFileLocator.NoOp, ClassFileLocator.Resolution, ClassFileLocator.Simple
CLASS_FILE_EXTENSION
Modifier | Constructor and Description |
---|---|
protected |
ForClassLoader(ClassLoader classLoader)
Creates a new class file locator for the given class loader.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object other) |
int |
hashCode() |
protected static ClassFileLocator.Resolution |
locate(ClassLoader classLoader,
String typeName)
Locates the class file for the supplied type by requesting a resource from the class loader.
|
ClassFileLocator.Resolution |
locate(String typeName)
Locates the class file for a given type and returns the binary data of the class file.
|
static ClassFileLocator |
of(ClassLoader classLoader)
Creates a class file locator for a given class loader.
|
static ClassFileLocator |
ofClassPath()
Creates a class file locator that queries the system class loader.
|
static ClassFileLocator.Resolution |
read(Class<?> type)
Attempts to create a binary representation of a loaded type by requesting data from its
ClassLoader . |
String |
toString() |
protected ForClassLoader(ClassLoader classLoader)
classLoader
- The class loader to query which must not be the bootstrap class loader, i.e. null
.public static ClassFileLocator ofClassPath()
public static ClassFileLocator of(ClassLoader classLoader)
classLoader
- The class loader to be used. If this class loader represents the bootstrap class
loader which is represented by the null
value, this system class loader
is used instead.public static ClassFileLocator.Resolution read(Class<?> type)
ClassLoader
.type
- The type of interest.public ClassFileLocator.Resolution locate(String typeName) throws IOException
ClassFileLocator
locate
in interface ClassFileLocator
typeName
- The name of the type to locate a class file representation for.IOException
- If reading a class file causes an error.protected static ClassFileLocator.Resolution locate(ClassLoader classLoader, String typeName) throws IOException
classLoader
- The class loader to query for the resource.typeName
- The name of the type for which to locate a class file.IOException
- If reading the class file causes an exception.Copyright © 2014–2016. All rights reserved.