Package net.bytebuddy.asm
Class Advice.AssignReturned.ToThis.Handler
java.lang.Object
net.bytebuddy.asm.Advice.AssignReturned.ToThis.Handler
- All Implemented Interfaces:
Advice.AssignReturned.Handler
- Enclosing class:
- Advice.AssignReturned.ToThis
@Enhance
public static class Advice.AssignReturned.ToThis.Handler
extends Object
implements Advice.AssignReturned.Handler
A handler for the
Advice.AssignReturned.ToThis
annotation.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
A handler factory for theAdvice.AssignReturned.ToThis
annotation which assigns an advice method's return value to the this reference of a non-static method. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final boolean
true
if this handler is applied on exit advice.private final int
The index in the array that is returned which represents the assigned value or a negative value if assigning a scalar value.private final Assigner.Typing
The typing to apply when assigning the returned value to the targeted value. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Handler
(int index, Assigner.Typing typing, boolean exit) A handler for assigning thethis
reference. -
Method Summary
Modifier and TypeMethodDescriptionint
getIndex()
Returns the array offset which this handler intends to assign or a negative value if this handler intends to assign a scalar value.resolve
(TypeDescription instrumentedType, MethodDescription instrumentedMethod, Assigner assigner, Advice.ArgumentHandler argumentHandler, TypeDescription.Generic type, StackManipulation value) Resolves this handler.
-
Field Details
-
index
private final int indexThe index in the array that is returned which represents the assigned value or a negative value if assigning a scalar value. -
typing
The typing to apply when assigning the returned value to the targeted value. -
exit
private final boolean exittrue
if this handler is applied on exit advice.
-
-
Constructor Details
-
Handler
A handler for assigning thethis
reference.- Parameters:
index
- The index in the array that is returned which represents the assigned value or a negative value if assigning a scalar value.typing
- The typing to apply when assigning the returned value to the targeted value.exit
-true
if this handler is applied on exit advice.
-
-
Method Details
-
getIndex
public int getIndex()Returns the array offset which this handler intends to assign or a negative value if this handler intends to assign a scalar value.- Specified by:
getIndex
in interfaceAdvice.AssignReturned.Handler
- Returns:
- The array offset which this handler intends to assign or a negative value if this handler intends to assign a scalar value.
-
resolve
public StackManipulation resolve(TypeDescription instrumentedType, MethodDescription instrumentedMethod, Assigner assigner, Advice.ArgumentHandler argumentHandler, TypeDescription.Generic type, StackManipulation value) Resolves this handler.- Specified by:
resolve
in interfaceAdvice.AssignReturned.Handler
- Parameters:
instrumentedType
- The instrumented type.instrumentedMethod
- The instrumented method.assigner
- The assigner to use.argumentHandler
- The argument handler for the handled advice method.type
- The type that this handler receives for assignment.value
- An instruction to load the handled value onto the operand stack.- Returns:
- The stack manipulation resolved by this handler.
-