Package net.bytebuddy.dynamic.loading
Interface ClassInjector
-
- All Known Implementing Classes:
ClassInjector.UsingInstrumentation
,ClassInjector.UsingLookup
,ClassInjector.UsingReflection
,ClassInjector.UsingUnsafe
public interface ClassInjector
A class injector is capable of injecting classes into a
ClassLoader
without requiring the class loader to being able to explicitly look up these classes.Important: Byte Buddy does not supply privileges when injecting code. When using a
SecurityManager
, the user of this injector is responsible for providing access to non-public properties.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
ClassInjector.UsingInstrumentation
A class injector using aInstrumentation
to append to either the boot classpath or the system class path.static class
ClassInjector.UsingLookup
A class injector that uses ajava.lang.invoke.MethodHandles$Lookup
object for defining a class.static class
ClassInjector.UsingReflection
A class injector that uses reflective method calls.static class
ClassInjector.UsingUnsafe
A class injector that usessun.misc.Unsafe
to inject classes.
-
Field Summary
Fields Modifier and Type Field Description static boolean
ALLOW_EXISTING_TYPES
Determines the default behavior for type injections when a type is already loaded.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.Map<TypeDescription,java.lang.Class<?>>
inject(java.util.Map<? extends TypeDescription,byte[]> types)
Injects the given types into the represented class loader.
-
-
-
Field Detail
-
ALLOW_EXISTING_TYPES
static final boolean ALLOW_EXISTING_TYPES
Determines the default behavior for type injections when a type is already loaded.- See Also:
- Constant Field Values
-
-
Method Detail
-
inject
java.util.Map<TypeDescription,java.lang.Class<?>> inject(java.util.Map<? extends TypeDescription,byte[]> types)
Injects the given types into the represented class loader.- Parameters:
types
- The types to load via injection.- Returns:
- The loaded types that were passed as arguments.
-
-