@HashCodeAndEqualsPlugin.Enhance public static class ClassFileLocator.ForInstrumentation extends Object implements ClassFileLocator
Modifier and Type | Class and Description |
---|---|
static interface |
ClassFileLocator.ForInstrumentation.ClassLoadingDelegate
A delegate that is queried for loading a class.
|
protected static interface |
ClassFileLocator.ForInstrumentation.Dispatcher
A dispatcher to interact with the
Instrumentation API. |
protected static class |
ClassFileLocator.ForInstrumentation.ExtractionClassFileTransformer
A non-operational class file transformer that remembers the binary format of a given class.
|
ClassFileLocator.Compound, ClassFileLocator.Filtering, ClassFileLocator.ForClassLoader, ClassFileLocator.ForFolder, ClassFileLocator.ForInstrumentation, ClassFileLocator.ForJarFile, ClassFileLocator.ForModule, ClassFileLocator.ForModuleFile, ClassFileLocator.ForUrl, ClassFileLocator.NoOp, ClassFileLocator.PackageDiscriminating, ClassFileLocator.Resolution, ClassFileLocator.Simple
CLASS_FILE_EXTENSION
Constructor and Description |
---|
ForInstrumentation(Instrumentation instrumentation,
ClassFileLocator.ForInstrumentation.ClassLoadingDelegate classLoadingDelegate)
Creates an agent-based class file locator.
|
ForInstrumentation(Instrumentation instrumentation,
ClassLoader classLoader)
Creates an agent-based class file locator.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
static ClassFileLocator |
fromInstalledAgent(ClassLoader classLoader)
Returns an agent-based class file locator for the given class loader and an already installed
Byte Buddy-agent.
|
ClassFileLocator.Resolution |
locate(String name)
Locates the class file for a given type and returns the binary data of the class file.
|
static ClassFileLocator |
of(Instrumentation instrumentation,
Class<?> type)
Returns a class file locator that is capable of locating a class file for the given type using the given instrumentation instance.
|
public ForInstrumentation(Instrumentation instrumentation, @MaybeNull ClassLoader classLoader)
instrumentation
- The instrumentation to be used.classLoader
- The class loader to read a class from or null
to use the boot loader.public ForInstrumentation(Instrumentation instrumentation, ClassFileLocator.ForInstrumentation.ClassLoadingDelegate classLoadingDelegate)
instrumentation
- The instrumentation to be used.classLoadingDelegate
- The delegate responsible for class loading.public static ClassFileLocator fromInstalledAgent(@MaybeNull ClassLoader classLoader)
classLoader
- The class loader that is expected to load the looked-up a class.public static ClassFileLocator of(Instrumentation instrumentation, 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(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 Closeable
close
in interface AutoCloseable
Copyright © 2014–2024. All rights reserved.