Package net.bytebuddy.asm
Class MemberSubstitution.Substitution.Chain<S extends MemberSubstitution.Target>
- java.lang.Object
-
- net.bytebuddy.asm.MemberSubstitution.Substitution.Chain<S>
-
- Type Parameters:
S
- The type of the matched target.
- All Implemented Interfaces:
MemberSubstitution.Substitution<S>
- Enclosing interface:
- MemberSubstitution.Substitution<T extends MemberSubstitution.Target>
@Enhance public static class MemberSubstitution.Substitution.Chain<S extends MemberSubstitution.Target> extends java.lang.Object implements MemberSubstitution.Substitution<S>
A substitution chain allows for chaining multiple substitution steps for a byte code element being replaced.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MemberSubstitution.Substitution.Chain.Factory<U extends MemberSubstitution.Target>
A factory for creating a substitution chain.static interface
MemberSubstitution.Substitution.Chain.Step<U extends MemberSubstitution.Target>
Represents a step of a substitution chain.-
Nested classes/interfaces inherited from interface net.bytebuddy.asm.MemberSubstitution.Substitution
MemberSubstitution.Substitution.Chain<S extends MemberSubstitution.Target>, MemberSubstitution.Substitution.ForFieldAccess, MemberSubstitution.Substitution.ForMethodInvocation, MemberSubstitution.Substitution.ForValue, MemberSubstitution.Substitution.Stubbing
-
-
Field Summary
Fields Modifier and Type Field Description private Assigner
assigner
The assigner to use.private java.util.List<MemberSubstitution.Substitution.Chain.Step<? super S>>
steps
The substitution steps to apply.private Assigner.Typing
typing
The typing of the assignment to use.
-
Constructor Summary
Constructors Modifier Constructor Description protected
Chain(Assigner assigner, Assigner.Typing typing, java.util.List<MemberSubstitution.Substitution.Chain.Step<? super S>> steps)
Creates a new substitution chain.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StackManipulation
resolve(S target, TypeList.Generic parameters, TypeDescription.Generic result, JavaConstant.MethodHandle methodHandle, StackManipulation stackManipulation, int freeOffset)
Resolves this substitution into a stack manipulation.static <U extends MemberSubstitution.Target>
MemberSubstitution.Substitution.Chain.Factory<U>with(Assigner assigner, Assigner.Typing typing)
Creates a new substitution chain.static <U extends MemberSubstitution.Target>
MemberSubstitution.Substitution.Chain.Factory<U>withDefaultAssigner()
Creates a new substitution chain that uses a default assigner and static typing.
-
-
-
Field Detail
-
assigner
private final Assigner assigner
The assigner to use.
-
typing
private final Assigner.Typing typing
The typing of the assignment to use.
-
steps
private final java.util.List<MemberSubstitution.Substitution.Chain.Step<? super S extends MemberSubstitution.Target>> steps
The substitution steps to apply.
-
-
Constructor Detail
-
Chain
protected Chain(Assigner assigner, Assigner.Typing typing, java.util.List<MemberSubstitution.Substitution.Chain.Step<? super S>> 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 Detail
-
withDefaultAssigner
public static <U extends MemberSubstitution.Target> MemberSubstitution.Substitution.Chain.Factory<U> withDefaultAssigner()
Creates a new substitution chain that uses a default assigner and static typing.- Type Parameters:
U
- The type of the matched target.- Returns:
- A new substitution chain.
-
with
public static <U extends MemberSubstitution.Target> MemberSubstitution.Substitution.Chain.Factory<U> with(Assigner assigner, Assigner.Typing typing)
Creates a new substitution chain.- Type Parameters:
U
- The type of the matched target.- Parameters:
assigner
- The assigner to use.typing
- The typing of the assignment to use.- Returns:
- A new substitution chain.
-
resolve
public StackManipulation resolve(S target, TypeList.Generic parameters, TypeDescription.Generic result, JavaConstant.MethodHandle methodHandle, StackManipulation stackManipulation, int freeOffset)
Resolves this substitution into a stack manipulation.- Specified by:
resolve
in interfaceMemberSubstitution.Substitution<S extends MemberSubstitution.Target>
- Parameters:
target
- The targeted member 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.methodHandle
- A method handle describing the substituted expression.stackManipulation
- The original byte code expression that is being executed.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.
-
-