Package net.bytebuddy.dynamic.loading
Class ClassInjector.UsingInstrumentation
- java.lang.Object
-
- net.bytebuddy.dynamic.loading.ClassInjector.AbstractBase
-
- net.bytebuddy.dynamic.loading.ClassInjector.UsingInstrumentation
-
- All Implemented Interfaces:
ClassInjector
- Enclosing interface:
- ClassInjector
@Enhance public static class ClassInjector.UsingInstrumentation extends ClassInjector.AbstractBase
A class injector using aInstrumentationto append to either the boot classpath or the system class path.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static interfaceClassInjector.UsingInstrumentation.DispatcherA dispatcher to interact with the instrumentation API.static classClassInjector.UsingInstrumentation.TargetA representation of the target to which Java classes should be appended to.-
Nested classes/interfaces inherited from interface net.bytebuddy.dynamic.loading.ClassInjector
ClassInjector.AbstractBase, ClassInjector.UsingInstrumentation, ClassInjector.UsingLookup, ClassInjector.UsingReflection, ClassInjector.UsingUnsafe
-
-
Field Summary
-
Fields inherited from interface net.bytebuddy.dynamic.loading.ClassInjector
ALLOW_EXISTING_TYPES, SUPPRESS_ACCESS_CHECKS
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedUsingInstrumentation(File folder, ClassInjector.UsingInstrumentation.Target target, Instrumentation instrumentation, RandomString randomString)Creates an instrumentation-based class injector.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,Class<?>>injectRaw(Map<? extends String,byte[]> types)Injects the given types into the represented class loader using a mapping from name to binary representation.booleanisAlive()Indicates if this class injector is available on the current VM.static booleanisAvailable()Returnstrueif this class injector is available on this VM.static ClassInjectorof(File folder, ClassInjector.UsingInstrumentation.Target target, Instrumentation instrumentation)Creates an instrumentation-based class injector.-
Methods inherited from class net.bytebuddy.dynamic.loading.ClassInjector.AbstractBase
inject
-
-
-
-
Constructor Detail
-
UsingInstrumentation
protected UsingInstrumentation(File folder, ClassInjector.UsingInstrumentation.Target target, Instrumentation instrumentation, RandomString randomString)
Creates an instrumentation-based class injector.- Parameters:
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.
-
-
Method Detail
-
of
public static ClassInjector of(File folder, ClassInjector.UsingInstrumentation.Target target, Instrumentation instrumentation)
Creates an instrumentation-based class injector.- Parameters:
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.- Returns:
- An appropriate class injector that applies instrumentation.
-
isAlive
public boolean isAlive()
Indicates if this class injector is available on the current VM.- Returns:
trueif this injector is available on the current VM.
-
injectRaw
public Map<String,Class<?>> injectRaw(Map<? extends String,byte[]> types)
Injects the given types into the represented class loader using a mapping from name to binary representation.- Parameters:
types- The types to load via injection.- Returns:
- The loaded types that were passed as arguments.
-
isAvailable
public static boolean isAvailable()
Returnstrueif this class injector is available on this VM.- Returns:
trueif this class injector is available on this VM.
-
-