Package net.bytebuddy.asm
Class Advice.Dispatcher.RelocationHandler.ForType
java.lang.Object
net.bytebuddy.asm.Advice.Dispatcher.RelocationHandler.ForType
- All Implemented Interfaces:
Advice.Dispatcher.RelocationHandler
- Enclosing interface:
Advice.Dispatcher.RelocationHandler
@Enhance
public static class Advice.Dispatcher.RelocationHandler.ForType
extends Object
implements Advice.Dispatcher.RelocationHandler
A relocation handler that is triggered if the checked value is an instance of a given type.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected class
A bound relocation handler forAdvice.Dispatcher.RelocationHandler.ForType
.Nested classes/interfaces inherited from interface net.bytebuddy.asm.Advice.Dispatcher.RelocationHandler
Advice.Dispatcher.RelocationHandler.Disabled, Advice.Dispatcher.RelocationHandler.ForType, Advice.Dispatcher.RelocationHandler.ForValue, Advice.Dispatcher.RelocationHandler.Relocation
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final int
The index of the array returned by the advice method that contains the value to check for its type.private final TypeDescription
The type that triggers a relocation. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ForType
(TypeDescription typeDescription, int index) Creates a new relocation handler that triggers a relocation if a value is an instance of a given type. -
Method Summary
Modifier and TypeMethodDescriptionbind
(MethodDescription instrumentedMethod, Advice.Dispatcher.RelocationHandler.Relocation relocation) Binds this relocation handler to a relocation dispatcher.protected static Advice.Dispatcher.RelocationHandler
of
(TypeDescription typeDescription, int index, TypeDefinition returnedType) Resolves a relocation handler that is triggered if the checked instance is of a given type.
-
Field Details
-
typeDescription
The type that triggers a relocation. -
index
private final int indexThe index of the array returned by the advice method that contains the value to check for its type.
-
-
Constructor Details
-
ForType
Creates a new relocation handler that triggers a relocation if a value is an instance of a given type.- Parameters:
typeDescription
- The type that triggers a relocation.index
- The index of the array returned by the advice method that contains the value to check for its type.
-
-
Method Details
-
of
protected static Advice.Dispatcher.RelocationHandler of(TypeDescription typeDescription, int index, TypeDefinition returnedType) Resolves a relocation handler that is triggered if the checked instance is of a given type.- Parameters:
typeDescription
- The type that triggers a relocation.index
- The array index of the value that is returned.returnedType
- The type that is returned by the advice method.- Returns:
- An appropriate relocation handler.
-
bind
public Advice.Dispatcher.RelocationHandler.Bound bind(MethodDescription instrumentedMethod, Advice.Dispatcher.RelocationHandler.Relocation relocation) Binds this relocation handler to a relocation dispatcher.- Specified by:
bind
in interfaceAdvice.Dispatcher.RelocationHandler
- Parameters:
instrumentedMethod
- The instrumented method.relocation
- The relocation to apply.- Returns:
- A bound relocation handler.
-