Package net.bytebuddy.agent.builder
Class AgentBuilder.InitializationStrategy.SelfInjection.Dispatcher.InjectingInitializer
- java.lang.Object
-
- net.bytebuddy.agent.builder.AgentBuilder.InitializationStrategy.SelfInjection.Dispatcher.InjectingInitializer
-
- All Implemented Interfaces:
LoadedTypeInitializer
- Enclosing class:
- AgentBuilder.InitializationStrategy.SelfInjection.Dispatcher
@Enhance protected static class AgentBuilder.InitializationStrategy.SelfInjection.Dispatcher.InjectingInitializer extends java.lang.Object implements LoadedTypeInitializer
A type initializer that injects all auxiliary types of the instrumented type.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.bytebuddy.implementation.LoadedTypeInitializer
LoadedTypeInitializer.Compound, LoadedTypeInitializer.ForStaticField, LoadedTypeInitializer.NoOp
-
-
Field Summary
Fields Modifier and Type Field Description private ClassInjector
classInjector
The class injector to use.private TypeDescription
instrumentedType
The instrumented type.private java.util.Map<TypeDescription,LoadedTypeInitializer>
loadedTypeInitializers
The instrumented types and auxiliary types mapped to their loaded type initializers.private java.util.Map<TypeDescription,byte[]>
rawAuxiliaryTypes
The auxiliary types mapped to their class file representation.
-
Constructor Summary
Constructors Modifier Constructor Description protected
InjectingInitializer(TypeDescription instrumentedType, java.util.Map<TypeDescription,byte[]> rawAuxiliaryTypes, java.util.Map<TypeDescription,LoadedTypeInitializer> loadedTypeInitializers, ClassInjector classInjector)
Creates a new injection initializer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isAlive()
Indicates if this initializer is alive and needs to be invoked.void
onLoad(java.lang.Class<?> type)
Callback that is invoked on the creation of an instrumented type.
-
-
-
Field Detail
-
instrumentedType
private final TypeDescription instrumentedType
The instrumented type.
-
rawAuxiliaryTypes
private final java.util.Map<TypeDescription,byte[]> rawAuxiliaryTypes
The auxiliary types mapped to their class file representation.
-
loadedTypeInitializers
private final java.util.Map<TypeDescription,LoadedTypeInitializer> loadedTypeInitializers
The instrumented types and auxiliary types mapped to their loaded type initializers. The instrumented types and auxiliary types mapped to their loaded type initializers.
-
classInjector
private final ClassInjector classInjector
The class injector to use.
-
-
Constructor Detail
-
InjectingInitializer
protected InjectingInitializer(TypeDescription instrumentedType, java.util.Map<TypeDescription,byte[]> rawAuxiliaryTypes, java.util.Map<TypeDescription,LoadedTypeInitializer> loadedTypeInitializers, ClassInjector classInjector)
Creates a new injection initializer.- Parameters:
instrumentedType
- The instrumented type.rawAuxiliaryTypes
- The auxiliary types mapped to their class file representation.loadedTypeInitializers
- The instrumented types and auxiliary types mapped to their loaded type initializers.classInjector
- The class injector to use.
-
-
Method Detail
-
onLoad
public void onLoad(java.lang.Class<?> type)
Callback that is invoked on the creation of an instrumented type. If the loaded type initializer is alive, this method should be implemented empty instead of throwing an exception.- Specified by:
onLoad
in interfaceLoadedTypeInitializer
- Parameters:
type
- The manifestation of the instrumented type.
-
isAlive
public boolean isAlive()
Indicates if this initializer is alive and needs to be invoked. This is only meant as a mark. A loaded type initializer that is not alive might still be called and must therefore not throw an exception but rather provide an empty implementation.- Specified by:
isAlive
in interfaceLoadedTypeInitializer
- Returns:
true
if this initializer is alive.
-
-