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 java.lang.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 Classes Modifier and Type Class Description static interfaceMemberSubstitution.Substitution.Chain.Step.ForDelegation.BootstrapArgumentResolverA resolver for supplying arguments to a bootstrap method which is binding the delegation method's invocation.protected static interfaceMemberSubstitution.Substitution.Chain.Step.ForDelegation.DispatcherA dispatcher for invoking a delegation method.protected static classMemberSubstitution.Substitution.Chain.Step.ForDelegation.FactoryA factory for creating a delegating step during a member substitution.static interfaceMemberSubstitution.Substitution.Chain.Step.ForDelegation.OffsetMappingAn offset mapping for binding a parameter or dispatch target for the method or constructor that is delegated to.static classMemberSubstitution.Substitution.Chain.Step.ForDelegation.WithCustomMappingA factory for aMemberSubstitution.Substitution.Chain.Step.ForDelegationwhich 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
Fields Modifier and Type Field Description private MemberSubstitution.Substitution.Chain.Step.ForDelegation.Dispatcher.ResolveddispatcherThe dispatcher to use.private java.util.List<MemberSubstitution.Substitution.Chain.Step.ForDelegation.OffsetMapping.Resolved>offsetMappingsA list of offset mappings to execute prior to delegation.private TypeDescription.GenericreturnedThe type on top of the stack after the delegation is complete.
-
Constructor Summary
Constructors Modifier Constructor Description protectedForDelegation(TypeDescription.Generic returned, MemberSubstitution.Substitution.Chain.Step.ForDelegation.Dispatcher.Resolved dispatcher, java.util.List<MemberSubstitution.Substitution.Chain.Step.ForDelegation.OffsetMapping.Resolved> offsetMappings)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description MemberSubstitution.Substitution.Chain.Step.Resolutionresolve(TypeDescription receiver, ByteCodeElement.Member original, TypeList.Generic parameters, TypeDescription.Generic result, JavaConstant.MethodHandle methodHandle, StackManipulation stackManipulation, TypeDescription.Generic current, java.util.Map<java.lang.Integer,java.lang.Integer> offsets, int freeOffset)Resolves this step of a substitution chain.static MemberSubstitution.Substitution.Chain.Step.Factoryto(java.lang.reflect.Constructor<?> constructor)Returns a delegating step factory for the supplied constructor.static MemberSubstitution.Substitution.Chain.Step.Factoryto(java.lang.reflect.Method method)Returns a delegating step factory for the supplied method.static MemberSubstitution.Substitution.Chain.Step.Factoryto(MethodDescription.InDefinedShape methodDescription)Returns a delegating step factory for the supplied method description..private static MemberSubstitution.Substitution.Chain.Step.Factoryto(MethodDescription.InDefinedShape delegate, MemberSubstitution.Substitution.Chain.Step.ForDelegation.Dispatcher.Factory dispatcherFactory, java.util.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.static MemberSubstitution.Substitution.Chain.Step.ForDelegation.WithCustomMappingwithCustomMapping()Returns a builder for creating aMemberSubstitution.Substitution.Chain.Step.ForDelegationwith custom configuration.
-
-
-
Field Detail
-
returned
private final TypeDescription.Generic returned
The type on top of the stack after the delegation is complete.
-
dispatcher
private final MemberSubstitution.Substitution.Chain.Step.ForDelegation.Dispatcher.Resolved dispatcher
The dispatcher to use.
-
offsetMappings
private final java.util.List<MemberSubstitution.Substitution.Chain.Step.ForDelegation.OffsetMapping.Resolved> offsetMappings
A list of offset mappings to execute prior to delegation.
-
-
Constructor Detail
-
ForDelegation
protected ForDelegation(TypeDescription.Generic returned, MemberSubstitution.Substitution.Chain.Step.ForDelegation.Dispatcher.Resolved dispatcher, java.util.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 Detail
-
to
public static MemberSubstitution.Substitution.Chain.Step.Factory to(java.lang.reflect.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 to(java.lang.reflect.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 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, java.util.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(TypeDescription receiver, ByteCodeElement.Member original, TypeList.Generic parameters, TypeDescription.Generic result, JavaConstant.MethodHandle methodHandle, StackManipulation stackManipulation, TypeDescription.Generic current, java.util.Map<java.lang.Integer,java.lang.Integer> offsets, int freeOffset)
Resolves this step of a substitution chain.- Specified by:
resolvein 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.
-
-