@HashCodeAndEqualsPlugin.Enhance public static class ClassInjector.UsingInstrumentation extends ClassInjector.AbstractBase
Instrumentation
to append to either the boot classpath
or the system class path.Modifier and Type | Class and Description |
---|---|
protected static interface |
ClassInjector.UsingInstrumentation.Dispatcher
A dispatcher to interact with the instrumentation API.
|
static class |
ClassInjector.UsingInstrumentation.Target
A representation of the target to which Java classes should be appended to.
|
ClassInjector.AbstractBase, ClassInjector.UsingInstrumentation, ClassInjector.UsingLookup, ClassInjector.UsingReflection, ClassInjector.UsingUnsafe
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
CLASS_FILE_EXTENSION
The class file extension.
|
private static ClassInjector.UsingInstrumentation.Dispatcher |
DISPATCHER
A dispatcher for interacting with the instrumentation API.
|
private java.io.File |
folder
The folder to be used for storing jar files.
|
private java.lang.instrument.Instrumentation |
instrumentation
The instrumentation to use for appending to the class path or the boot path.
|
private static java.lang.String |
JAR
The jar file name extension.
|
private RandomString |
randomString
A random string generator for creating file names.
|
private ClassInjector.UsingInstrumentation.Target |
target
A representation of the target path to which classes are to be appended.
|
ALLOW_EXISTING_TYPES, SUPPRESS_ACCESS_CHECKS
Modifier | Constructor and Description |
---|---|
protected |
UsingInstrumentation(java.io.File folder,
ClassInjector.UsingInstrumentation.Target target,
java.lang.instrument.Instrumentation instrumentation,
RandomString randomString)
Creates an instrumentation-based class injector.
|
Modifier and Type | Method and Description |
---|---|
java.util.Map<java.lang.String,java.lang.Class<?>> |
injectRaw(java.util.Map<? extends java.lang.String,byte[]> types)
Injects the given types into the represented class loader using a mapping from name to binary representation.
|
boolean |
isAlive()
Indicates if this class injector is available on the current VM.
|
static boolean |
isAvailable()
Returns
true if this class injector is available on this VM. |
static ClassInjector |
of(java.io.File folder,
ClassInjector.UsingInstrumentation.Target target,
java.lang.instrument.Instrumentation instrumentation)
Creates an instrumentation-based class injector.
|
inject
private static final java.lang.String JAR
private static final java.lang.String CLASS_FILE_EXTENSION
private static final ClassInjector.UsingInstrumentation.Dispatcher DISPATCHER
private final java.lang.instrument.Instrumentation instrumentation
private final ClassInjector.UsingInstrumentation.Target target
private final java.io.File folder
private final RandomString randomString
protected UsingInstrumentation(java.io.File folder, ClassInjector.UsingInstrumentation.Target target, java.lang.instrument.Instrumentation instrumentation, RandomString randomString)
folder
- The folder to be used for storing jar files.target
- A representation of the target path to which classes are to be appended.instrumentation
- The instrumentation to use for appending to the class path or the boot path.randomString
- The random string generator to use.public static ClassInjector of(java.io.File folder, ClassInjector.UsingInstrumentation.Target target, java.lang.instrument.Instrumentation instrumentation)
folder
- The folder to be used for storing jar files.target
- A representation of the target path to which classes are to be appended.instrumentation
- The instrumentation to use for appending to the class path or the boot path.public boolean isAlive()
true
if this injector is available on the current VM.public java.util.Map<java.lang.String,java.lang.Class<?>> injectRaw(java.util.Map<? extends java.lang.String,byte[]> types)
types
- The types to load via injection.public static boolean isAvailable()
true
if this class injector is available on this VM.true
if this class injector is available on this VM.