Package net.bytebuddy.asm
Class Advice.AssignReturned.ToFields.Handler
- java.lang.Object
-
- net.bytebuddy.asm.Advice.AssignReturned.ToFields.Handler
-
- All Implemented Interfaces:
Advice.AssignReturned.Handler
- Enclosing class:
- Advice.AssignReturned.ToFields
@Enhance public static class Advice.AssignReturned.ToFields.Handler extends java.lang.Object implements Advice.AssignReturned.Handler
A handler for aAdvice.AssignReturned.ToFields.ToField
annotation.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Advice.AssignReturned.ToFields.Handler.Factory
A factory to create a handler for aAdvice.AssignReturned.ToFields
annotation.
-
Field Summary
Fields Modifier and Type Field Description private TypeDescription
declaringType
The field's declaring type orvoid
if the type should be found within the instrumented type's hierarchy.private int
index
The index in the array that is returned which represents the assigned value or a negative value if assigning a scalar value.private java.lang.String
name
The accessed field's name or an empty string if the field name should be inferred from the method's accessor name.private Assigner.Typing
typing
The typing to apply when assigning the returned value to the targeted value.
-
Constructor Summary
Constructors Modifier Constructor Description protected
Handler(int index, java.lang.String name, TypeDescription declaringType, Assigner.Typing typing)
Creates a new handler for aAdvice.AssignReturned.ToReturned
annotation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.StackManipulation
resolve(TypeDescription instrumentedType, MethodDescription instrumentedMethod, Assigner assigner, Advice.ArgumentHandler argumentHandler, TypeDescription.Generic type, StackManipulation value)
Resolves this handler.
-
-
-
Field Detail
-
index
private final int index
The index in the array that is returned which represents the assigned value or a negative value if assigning a scalar value.
-
name
private final java.lang.String name
The accessed field's name or an empty string if the field name should be inferred from the method's accessor name.
-
declaringType
private final TypeDescription declaringType
The field's declaring type orvoid
if the type should be found within the instrumented type's hierarchy.
-
typing
private final Assigner.Typing typing
The typing to apply when assigning the returned value to the targeted value.
-
-
Constructor Detail
-
Handler
protected Handler(int index, java.lang.String name, TypeDescription declaringType, Assigner.Typing typing)
Creates a new handler for aAdvice.AssignReturned.ToReturned
annotation.- Parameters:
index
- The index in the array that is returned which represents the assigned value or a negative value if assigning a scalar value.name
- The accessed field's name or an empty string if the field name should be inferred from the method's accessor name.declaringType
- The field's declaring type orvoid
if the type should be found within the instrumented type's hierarchy.typing
- The typing to apply when assigning the returned value to the targeted value.
-
-
Method Detail
-
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.
-
-