Package net.bytebuddy.asm
Class Advice.Delegator.ForDynamicInvocation
- java.lang.Object
-
- net.bytebuddy.asm.Advice.Delegator.ForDynamicInvocation
-
- All Implemented Interfaces:
Advice.Delegator
- Enclosing interface:
- Advice.Delegator
@Enhance public static class Advice.Delegator.ForDynamicInvocation extends java.lang.Object implements Advice.Delegator
Invokes an advice method using a dynamic method call.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
Advice.Delegator.ForDynamicInvocation.Factory
A factory for creating a dynamic invocation dispatcher.-
Nested classes/interfaces inherited from interface net.bytebuddy.asm.Advice.Delegator
Advice.Delegator.ForDynamicInvocation, Advice.Delegator.ForRegularInvocation
-
-
Field Summary
Fields Modifier and Type Field Description private MethodDescription.InDefinedShape
adviceMethod
The advice method.private MethodDescription.InDefinedShape
bootstrapMethod
The bootstrap method.private Advice.BootstrapArgumentResolver
resolver
A resolver to provide the arguments to the bootstrap method.
-
Constructor Summary
Constructors Modifier Constructor Description protected
ForDynamicInvocation(MethodDescription.InDefinedShape bootstrapMethod, MethodDescription.InDefinedShape adviceMethod, Advice.BootstrapArgumentResolver resolver)
Creates a delegator for a dynamic method invocation.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StackManipulation
apply(TypeDescription instrumentedType, MethodDescription instrumentedMethod)
Materializes an invocation.protected static Advice.Delegator.Factory
of(MethodDescription.InDefinedShape bootstrapMethod, Advice.BootstrapArgumentResolver.Factory resolverFactory)
Creates a new dynamic invocation delegator.
-
-
-
Field Detail
-
bootstrapMethod
private final MethodDescription.InDefinedShape bootstrapMethod
The bootstrap method.
-
adviceMethod
private final MethodDescription.InDefinedShape adviceMethod
The advice method.
-
resolver
private final Advice.BootstrapArgumentResolver resolver
A resolver to provide the arguments to the bootstrap method.
-
-
Constructor Detail
-
ForDynamicInvocation
protected ForDynamicInvocation(MethodDescription.InDefinedShape bootstrapMethod, MethodDescription.InDefinedShape adviceMethod, Advice.BootstrapArgumentResolver resolver)
Creates a delegator for a dynamic method invocation.- Parameters:
bootstrapMethod
- The bootstrap method.adviceMethod
- The advice method.resolver
- A resolver to provide the arguments to the bootstrap method.
-
-
Method Detail
-
of
protected static Advice.Delegator.Factory of(MethodDescription.InDefinedShape bootstrapMethod, Advice.BootstrapArgumentResolver.Factory resolverFactory)
Creates a new dynamic invocation delegator.- Parameters:
bootstrapMethod
- The bootstrap method or constructor.resolverFactory
- A resolver factory to provide the arguments to the bootstrap method.- Returns:
- An appropriate delegator.
-
apply
public StackManipulation apply(TypeDescription instrumentedType, MethodDescription instrumentedMethod)
Materializes an invocation.- Specified by:
apply
in interfaceAdvice.Delegator
- Parameters:
instrumentedType
- The instrumented type.instrumentedMethod
- The instrumented method.- Returns:
- An appropriate stack manipulation which needs to consume all arguments for the advice method and needs to provide a compatible return type.
-
-