Class MemberSubstitution.Substitution.Chain.Step.ForAssignment
java.lang.Object
net.bytebuddy.asm.MemberSubstitution.Substitution.Chain.Step.ForAssignment
- All Implemented Interfaces:
MemberSubstitution.Substitution.Chain.Step<MemberSubstitution.Target>
- Enclosing interface:
MemberSubstitution.Substitution.Chain.Step<U extends MemberSubstitution.Target>
@Enhance
public static class MemberSubstitution.Substitution.Chain.Step.ForAssignment
extends Object
implements MemberSubstitution.Substitution.Chain.Step<MemberSubstitution.Target>
A step within a substitution chain that converts the current type to another type by casting.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classA factory for creating a step for a dynamic type assignment.Nested classes/interfaces inherited from interface MemberSubstitution.Substitution.Chain.Step
MemberSubstitution.Substitution.Chain.Step.ForArgumentLoading, MemberSubstitution.Substitution.Chain.Step.ForArgumentSubstitution, MemberSubstitution.Substitution.Chain.Step.ForAssignment, MemberSubstitution.Substitution.Chain.Step.ForDelegation, MemberSubstitution.Substitution.Chain.Step.ForField, MemberSubstitution.Substitution.Chain.Step.ForInvocation, MemberSubstitution.Substitution.Chain.Step.OfOriginalExpression, MemberSubstitution.Substitution.Chain.Step.Resolution, MemberSubstitution.Substitution.Chain.Step.Simple -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AssignerThe assigner to use.private final TypeDescription.GenericThe result type ornullif the type of the substitution result should be targeted. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedForAssignment(TypeDescription.Generic result, Assigner assigner) Creates a step for a type assignment. -
Method Summary
Modifier and TypeMethodDescriptionCreates a step factory that casts the current stack top value to the specified type.castTo(TypeDescription.Generic typeDescription) Creates a step factory that casts the current stack top value to the specified type.Creates a step factory that casts the current stack top value to the expected return value.resolve(MemberSubstitution.Target target, TypeList.Generic parameters, TypeDescription.Generic result, JavaConstant.MethodHandle methodHandle, StackManipulation stackManipulation, TypeDescription.Generic current, Map<Integer, Integer> offsets, int freeOffset) Resolves this step of a substitution chain.
-
Field Details
-
result
The result type ornullif the type of the substitution result should be targeted. -
assigner
The assigner to use.
-
-
Constructor Details
-
ForAssignment
Creates a step for a type assignment.- Parameters:
result- The result type ornullif the type of the substitution result should be targeted.assigner- The assigner to use.
-
-
Method Details
-
castTo
public static MemberSubstitution.Substitution.Chain.Step.Factory<MemberSubstitution.Target> castTo(Type type) Creates a step factory that casts the current stack top value to the specified type.- Parameters:
type- The type that should be cast to.- Returns:
- An appropriate step factory.
-
castTo
public static MemberSubstitution.Substitution.Chain.Step.Factory<MemberSubstitution.Target> castTo(TypeDescription.Generic typeDescription) Creates a step factory that casts the current stack top value to the specified type.- Parameters:
typeDescription- The description of the type that should be cast to.- Returns:
- An appropriate step factory.
-
castToSubstitutionResult
public static MemberSubstitution.Substitution.Chain.Step.Factory<MemberSubstitution.Target> castToSubstitutionResult()Creates a step factory that casts the current stack top value to the expected return value.- Returns:
- An appropriate step factory.
-
resolve
public MemberSubstitution.Substitution.Chain.Step.Resolution resolve(MemberSubstitution.Target target, TypeList.Generic parameters, TypeDescription.Generic result, JavaConstant.MethodHandle methodHandle, StackManipulation stackManipulation, TypeDescription.Generic current, Map<Integer, Integer> offsets, int freeOffset) Resolves this step of a substitution chain.- Specified by:
resolvein interfaceMemberSubstitution.Substitution.Chain.Step<MemberSubstitution.Target>- Parameters:
target- The target member of invokedynamic invocation.parameters- The parameters of the substituted element.result- The resulting type of the substituted element.methodHandle- A method handle of the stackManipulation invocation that is being substituted.stackManipulation- The byte code instruction that is being substituted.current- The current type of the applied substitution that is the top element on the operand stack.offsets- The arguments of the substituted byte code element mapped to their local variable offsets.freeOffset- The first free offset in the local variable array.- Returns:
- A resolved substitution step for the supplied inputs.
-