Class MemberSubstitution.Substitution.Chain.Step.ForDelegation
java.lang.Object
net.bytebuddy.asm.MemberSubstitution.Substitution.Chain.Step.ForDelegation
- 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.ForDelegation
extends Object
implements MemberSubstitution.Substitution.Chain.Step<MemberSubstitution.Target>
A step that invokes a delegation method based on annotations on the parameters of the targeted method.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceA resolver for supplying arguments to a bootstrap method which is binding the delegation method's invocation.protected static interfaceA dispatcher for invoking a delegation method.protected static classA factory for creating a delegating step during a member substitution.static interfaceAn offset mapping for binding a parameter or dispatch target for the method or constructor that is delegated to.static classA factory for aMemberSubstitution.Substitution.Chain.Step.ForDelegationwhich allows for a custom configuration.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 TypeFieldDescriptionThe dispatcher to use.A list of offset mappings to execute prior to delegation.private final TypeDescription.GenericThe type on top of the stack after the delegation is complete. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedForDelegation(TypeDescription.Generic returned, MemberSubstitution.Substitution.Chain.Step.ForDelegation.Dispatcher.Resolved dispatcher, List<MemberSubstitution.Substitution.Chain.Step.ForDelegation.OffsetMapping.Resolved> offsetMappings) -
Method Summary
Modifier and TypeMethodDescriptionresolve(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.to(Constructor<?> constructor) Returns a delegating step factory for the supplied constructor.Returns a delegating step factory for the supplied method.to(MethodDescription.InDefinedShape methodDescription) Returns a delegating step factory for the supplied method description..to(MethodDescription.InDefinedShape delegate, MemberSubstitution.Substitution.Chain.Step.ForDelegation.Dispatcher.Factory dispatcherFactory, List<? extends MemberSubstitution.Substitution.Chain.Step.ForDelegation.OffsetMapping.Factory<?>> userFactories) Creates an appropriate step factory for the given delegate method, dispatcher factory and user factories.Returns a builder for creating aMemberSubstitution.Substitution.Chain.Step.ForDelegationwith custom configuration.
-
Field Details
-
returned
The type on top of the stack after the delegation is complete. -
dispatcher
private final MemberSubstitution.Substitution.Chain.Step.ForDelegation.Dispatcher.Resolved dispatcherThe dispatcher to use. -
offsetMappings
private final List<MemberSubstitution.Substitution.Chain.Step.ForDelegation.OffsetMapping.Resolved> offsetMappingsA list of offset mappings to execute prior to delegation.
-
-
Constructor Details
-
ForDelegation
protected ForDelegation(TypeDescription.Generic returned, MemberSubstitution.Substitution.Chain.Step.ForDelegation.Dispatcher.Resolved dispatcher, List<MemberSubstitution.Substitution.Chain.Step.ForDelegation.OffsetMapping.Resolved> offsetMappings) - Parameters:
returned- The type on top of the stack after the delegation is complete.dispatcher- The dispatcher to use.offsetMappings- A list of offset mappings to execute prior to delegation.
-
-
Method Details
-
to
public static MemberSubstitution.Substitution.Chain.Step.Factory<MemberSubstitution.Target> to(Method method) Returns a delegating step factory for the supplied method.- Parameters:
method- The method to delegate to.- Returns:
- An appropriate step factory.
-
to
public static MemberSubstitution.Substitution.Chain.Step.Factory<MemberSubstitution.Target> to(Constructor<?> constructor) Returns a delegating step factory for the supplied constructor.- Parameters:
constructor- The constructor to delegate to.- Returns:
- An appropriate step factory.
-
to
public static MemberSubstitution.Substitution.Chain.Step.Factory<MemberSubstitution.Target> to(MethodDescription.InDefinedShape methodDescription) Returns a delegating step factory for the supplied method description..- Parameters:
methodDescription- A description of the method or constructor to delegate to.- Returns:
- An appropriate step factory.
-
to
private static MemberSubstitution.Substitution.Chain.Step.Factory<MemberSubstitution.Target> to(MethodDescription.InDefinedShape delegate, MemberSubstitution.Substitution.Chain.Step.ForDelegation.Dispatcher.Factory dispatcherFactory, List<? extends MemberSubstitution.Substitution.Chain.Step.ForDelegation.OffsetMapping.Factory<?>> userFactories) Creates an appropriate step factory for the given delegate method, dispatcher factory and user factories.- Parameters:
delegate- A description of the method or constructor to delegate to.dispatcherFactory- The dispatcher factory to use.userFactories- Factories for custom annotation bindings.- Returns:
- An appropriate step factory.
-
withCustomMapping
public static MemberSubstitution.Substitution.Chain.Step.ForDelegation.WithCustomMapping withCustomMapping()Returns a builder for creating aMemberSubstitution.Substitution.Chain.Step.ForDelegationwith custom configuration.- Returns:
- A bulder for creating a custom delegator.
-
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.
-