Package net.bytebuddy.asm
Class MemberSubstitution.Substitution.Chain.Step.ForDelegation
java.lang.Object
net.bytebuddy.asm.MemberSubstitution.Substitution.Chain.Step.ForDelegation
- All Implemented Interfaces:
MemberSubstitution.Substitution.Chain.Step
- Enclosing interface:
MemberSubstitution.Substitution.Chain.Step
@Enhance
public static class MemberSubstitution.Substitution.Chain.Step.ForDelegation
extends Object
implements MemberSubstitution.Substitution.Chain.Step
A step that invokes a delegation method based on annotations on the parameters of the targeted method.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
A resolver for supplying arguments to a bootstrap method which is binding the delegation method's invocation.protected static interface
A dispatcher for invoking a delegation method.protected static class
A factory for creating a delegating step during a member substitution.static interface
An offset mapping for binding a parameter or dispatch target for the method or constructor that is delegated to.static class
A factory for aMemberSubstitution.Substitution.Chain.Step.ForDelegation
which allows for a custom configuration.Nested classes/interfaces inherited from interface net.bytebuddy.asm.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.Generic
The type on top of the stack after the delegation is complete. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ForDelegation
(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
(TypeDescription receiver, ByteCodeElement.Member original, 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..private static MemberSubstitution.Substitution.Chain.Step.Factory
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.ForDelegation
with 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
Returns a delegating step factory for the supplied method.- Parameters:
method
- The method to delegate to.- Returns:
- An appropriate step factory.
-
to
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 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 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.ForDelegation
with custom configuration.- Returns:
- A bulder for creating a custom delegator.
-
resolve
public MemberSubstitution.Substitution.Chain.Step.Resolution resolve(TypeDescription receiver, ByteCodeElement.Member original, 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:
resolve
in interfaceMemberSubstitution.Substitution.Chain.Step
- Parameters:
receiver
- The target result type of the substitution.original
- The byte code element that is currently substituted.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.
-