Package net.bytebuddy.asm
Class MemberSubstitution.Substitution.Chain
java.lang.Object
net.bytebuddy.asm.MemberSubstitution.Substitution.Chain
- All Implemented Interfaces:
MemberSubstitution.Substitution
- Enclosing interface:
- MemberSubstitution.Substitution
@Enhance
public static class MemberSubstitution.Substitution.Chain
extends Object
implements MemberSubstitution.Substitution
A substitution chain allows for chaining multiple substitution steps for a byte code element being replaced.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
A factory for creating a substitution chain.static interface
Represents a step of a substitution chain.Nested classes/interfaces inherited from interface net.bytebuddy.asm.MemberSubstitution.Substitution
MemberSubstitution.Substitution.Chain, MemberSubstitution.Substitution.ForFieldAccess, MemberSubstitution.Substitution.ForMethodInvocation, MemberSubstitution.Substitution.Stubbing
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Assigner
The assigner to use.private final List<MemberSubstitution.Substitution.Chain.Step>
The substitution steps to apply.private final Assigner.Typing
The typing of the assignment to use. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Chain
(Assigner assigner, Assigner.Typing typing, List<MemberSubstitution.Substitution.Chain.Step> steps) Creates a new substitution chain. -
Method Summary
Modifier and TypeMethodDescriptionresolve
(TypeDescription targetType, ByteCodeElement target, TypeList.Generic parameters, TypeDescription.Generic result, int freeOffset) Resolves this substitution into a stack manipulation.with
(Assigner assigner, Assigner.Typing typing) Creates a new substitution chain.Creates a new substitution chain that uses a default assigner and static typing.
-
Field Details
-
assigner
The assigner to use. -
typing
The typing of the assignment to use. -
steps
The substitution steps to apply.
-
-
Constructor Details
-
Chain
protected Chain(Assigner assigner, Assigner.Typing typing, List<MemberSubstitution.Substitution.Chain.Step> steps) Creates a new substitution chain.- Parameters:
assigner
- The assigner to use.typing
- The typing of the assignment to use.steps
- The substitution steps to apply.
-
-
Method Details
-
withDefaultAssigner
Creates a new substitution chain that uses a default assigner and static typing.- Returns:
- A new substitution chain.
-
with
public static MemberSubstitution.Substitution.Chain.Factory with(Assigner assigner, Assigner.Typing typing) Creates a new substitution chain.- Parameters:
assigner
- The assigner to use.typing
- The typing of the assignment to use.- Returns:
- A new substitution chain.
-
resolve
public StackManipulation resolve(TypeDescription targetType, ByteCodeElement target, TypeList.Generic parameters, TypeDescription.Generic result, int freeOffset) Resolves this substitution into a stack manipulation.- Specified by:
resolve
in interfaceMemberSubstitution.Substitution
- Parameters:
targetType
- The target type on which a member is accessed.target
- The target field, method or constructor that is substituted,parameters
- All parameters that serve as input to this access.result
- The result that is expected from the interaction orvoid
if no result is expected.freeOffset
- The first free offset of the local variable array that can be used for storing values.- Returns:
- A stack manipulation that represents the access.
-