@HashCodeAndEqualsPlugin.Enhance public static class ClassFileLocator.AgentBased extends java.lang.Object implements ClassFileLocator
Modifier and Type | Class and Description |
---|---|
static interface |
ClassFileLocator.AgentBased.ClassLoadingDelegate
A delegate that is queried for loading a class.
|
protected static interface |
ClassFileLocator.AgentBased.Dispatcher
A dispatcher to interact with the
Instrumentation API. |
protected static class |
ClassFileLocator.AgentBased.ExtractionClassFileTransformer
A non-operational class file transformer that remembers the binary format of a given class.
|
ClassFileLocator.AgentBased, ClassFileLocator.Compound, ClassFileLocator.ForClassLoader, ClassFileLocator.ForFolder, ClassFileLocator.ForJarFile, ClassFileLocator.ForModule, ClassFileLocator.ForModuleFile, ClassFileLocator.ForUrl, ClassFileLocator.NoOp, ClassFileLocator.PackageDiscriminating, ClassFileLocator.Resolution, ClassFileLocator.Simple
Modifier and Type | Field and Description |
---|---|
private ClassFileLocator.AgentBased.ClassLoadingDelegate |
classLoadingDelegate
The delegate to load a class by its name.
|
private static ClassFileLocator.AgentBased.Dispatcher |
DISPATCHER
A dispatcher for interacting with the instrumentation API.
|
private static java.lang.String |
INSTALLER_TYPE
The name of the Byte Buddy
net.bytebuddy.agent.Installer class. |
private java.lang.instrument.Instrumentation |
instrumentation
The instrumentation instance to use for looking up the binary format of a type.
|
private static java.lang.String |
INSTRUMENTATION_GETTER
The name of the
net.bytebuddy.agent.Installer getter for reading an installed Instrumentation . |
private static java.lang.Object |
STATIC_MEMBER
Indicator for access to a static member via reflection to make the code more readable.
|
CLASS_FILE_EXTENSION
Constructor and Description |
---|
AgentBased(java.lang.instrument.Instrumentation instrumentation,
ClassFileLocator.AgentBased.ClassLoadingDelegate classLoadingDelegate)
Creates an agent-based class file locator.
|
AgentBased(java.lang.instrument.Instrumentation instrumentation,
java.lang.ClassLoader classLoader)
Creates an agent-based class file locator.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
static ClassFileLocator |
fromInstalledAgent(java.lang.ClassLoader classLoader)
Returns an agent-based class file locator for the given class loader and an already installed
Byte Buddy-agent.
|
ClassFileLocator.Resolution |
locate(java.lang.String name)
Locates the class file for a given type and returns the binary data of the class file.
|
static ClassFileLocator |
of(java.lang.instrument.Instrumentation instrumentation,
java.lang.Class<?> type)
Returns a class file locator that is capable of locating a class file for the given type using the given instrumentation instance.
|
private static final java.lang.String INSTALLER_TYPE
net.bytebuddy.agent.Installer
class.private static final java.lang.String INSTRUMENTATION_GETTER
net.bytebuddy.agent.Installer
getter for reading an installed Instrumentation
.private static final java.lang.Object STATIC_MEMBER
private static final ClassFileLocator.AgentBased.Dispatcher DISPATCHER
private final java.lang.instrument.Instrumentation instrumentation
private final ClassFileLocator.AgentBased.ClassLoadingDelegate classLoadingDelegate
public AgentBased(java.lang.instrument.Instrumentation instrumentation, java.lang.ClassLoader classLoader)
instrumentation
- The instrumentation to be used.classLoader
- The class loader to read a class from.public AgentBased(java.lang.instrument.Instrumentation instrumentation, ClassFileLocator.AgentBased.ClassLoadingDelegate classLoadingDelegate)
instrumentation
- The instrumentation to be used.classLoadingDelegate
- The delegate responsible for class loading.public static ClassFileLocator fromInstalledAgent(java.lang.ClassLoader classLoader)
classLoader
- The class loader that is expected to load the looked-up a class.public static ClassFileLocator of(java.lang.instrument.Instrumentation instrumentation, java.lang.Class<?> type)
instrumentation
- The instrumentation instance to query for a retransformation.type
- The locatable type which class loader is used as a fallback.public ClassFileLocator.Resolution locate(java.lang.String name)
locate
in interface ClassFileLocator
name
- The name of the type to locate a class file representation for.public void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable