@HashCodeAndEqualsPlugin.Enhance public static class Advice.WithCustomMapping extends Object
Advice
that uses custom mappings of annotations to constant pool values.Modifier | Constructor and Description |
---|---|
protected |
WithCustomMapping()
Creates a new custom mapping builder step without including any custom mappings.
|
protected |
WithCustomMapping(Advice.PostProcessor.Factory postProcessorFactory,
Map<Class<? extends Annotation>,Advice.OffsetMapping.Factory<?>> offsetMappings,
Advice.Delegator.Factory delegatorFactory)
Creates a new custom mapping builder step with the given custom mappings.
|
Modifier and Type | Method and Description |
---|---|
Advice.WithCustomMapping |
bind(Advice.OffsetMapping.Factory<?> offsetMapping)
Binds an annotation to a dynamically computed value.
|
<T extends Annotation> |
bind(Class<T> type,
Advice.OffsetMapping offsetMapping)
Binds the supplied annotation to the annotation's property of the specified name.
|
<T extends Annotation> |
bind(Class<T> type,
Class<?> value)
Binds the supplied annotation to the supplied type constant.
|
<T extends Annotation> |
bind(Class<T> type,
ConstantValue constant)
Binds the supplied annotation to the given Java constant.
|
<T extends Annotation> |
bind(Class<T> type,
Constructor<?> constructor,
int index)
Binds the supplied annotation to the supplied parameter's argument.
|
<T extends Annotation> |
bind(Class<T> type,
Enum<?> value)
Binds the supplied annotation to the supplied enumeration constant.
|
<T extends Annotation> |
bind(Class<T> type,
EnumerationDescription value)
Binds the supplied annotation to the supplied enumeration constant.
|
<T extends Annotation> |
bind(Class<T> type,
Field field)
Binds the supplied annotation to the value of the supplied field.
|
<T extends Annotation> |
bind(Class<T> type,
FieldDescription fieldDescription)
Binds the supplied annotation to the value of the supplied field.
|
<T extends Annotation> |
bind(Class<T> type,
JavaConstant constant)
Binds the supplied annotation to the given Java constant.
|
<T extends Annotation> |
bind(Class<T> type,
Method method,
int index)
Binds the supplied annotation to the supplied parameter's argument.
|
<T extends Annotation> |
bind(Class<T> type,
Object value)
Binds the supplied annotation to a type constant of the supplied value.
|
<T extends Annotation> |
bind(Class<T> type,
ParameterDescription parameterDescription)
Binds the supplied annotation to the supplied parameter's argument.
|
<T extends Annotation> |
bind(Class<T> type,
StackManipulation stackManipulation,
Type targetType)
Binds the supplied annotation to the annotation's property of the specified name.
|
<T extends Annotation> |
bind(Class<T> type,
StackManipulation stackManipulation,
TypeDescription.Generic targetType)
Binds the supplied annotation to the annotation's property of the specified name.
|
<T extends Annotation> |
bind(Class<T> type,
TypeDescription value)
Binds the supplied annotation to the supplied type constant.
|
<T extends Annotation> |
bindDynamic(Class<T> type,
Constructor<?> bootstrapMethod,
List<?> constants)
Binds the supplied annotation to a dynamically bootstrapped value.
|
<T extends Annotation> |
bindDynamic(Class<T> type,
Constructor<?> bootstrapMethod,
Object... constant)
Binds the supplied annotation to a dynamically bootstrapped value.
|
<T extends Annotation> |
bindDynamic(Class<T> type,
MethodDescription.InDefinedShape bootstrapMethod,
List<?> constants)
Binds the supplied annotation to a dynamically bootstrapped value.
|
<T extends Annotation> |
bindDynamic(Class<T> type,
MethodDescription.InDefinedShape bootstrapMethod,
Object... constant)
Binds the supplied annotation to a dynamically bootstrapped value.
|
<T extends Annotation> |
bindDynamic(Class<T> type,
Method bootstrapMethod,
List<?> constants)
Binds the supplied annotation to a dynamically bootstrapped value.
|
<T extends Annotation> |
bindDynamic(Class<T> type,
Method bootstrapMethod,
Object... constant)
Binds the supplied annotation to a dynamically bootstrapped value.
|
<T extends Annotation> |
bindLambda(Class<T> type,
Constructor<?> constructor,
Class<?> functionalInterface)
Binds the supplied annotation as a lambda expression via the JVM's lambda metafactory.
|
<T extends Annotation> |
bindLambda(Class<T> type,
Constructor<?> constructor,
Class<?> functionalInterface,
MethodGraph.Compiler methodGraphCompiler)
Binds the supplied annotation as a lambda expression via the JVM's lambda metafactory.
|
<T extends Annotation> |
bindLambda(Class<T> type,
Method method,
Class<?> functionalInterface)
Binds the supplied annotation as a lambda expression via the JVM's lambda metafactory.
|
<T extends Annotation> |
bindLambda(Class<T> type,
Method method,
Class<?> functionalInterface,
MethodGraph.Compiler methodGraphCompiler)
Binds the supplied annotation as a lambda expression via the JVM's lambda metafactory.
|
<T extends Annotation> |
bindLambda(Class<T> type,
MethodDescription.InDefinedShape methodDescription,
TypeDescription functionalInterface)
Binds the supplied annotation as a lambda expression via the JVM's lambda metafactory.
|
<T extends Annotation> |
bindLambda(Class<T> type,
MethodDescription.InDefinedShape methodDescription,
TypeDescription functionalInterface,
MethodGraph.Compiler methodGraphCompiler)
Binds the supplied annotation as a lambda expression via the JVM's lambda metafactory.
|
<T extends Annotation> |
bindProperty(Class<T> type,
String property)
Binds the supplied annotation to the annotation's property of the specified name.
|
<T extends Annotation,S extends Serializable> |
bindSerialized(Class<T> type,
S value,
Class<? super S> targetType)
Binds the supplied annotation to the supplied fixed value.
|
<T extends Annotation> |
bindSerialized(Class<T> type,
Serializable value)
Binds the supplied annotation to the supplied fixed value.
|
Advice.WithCustomMapping |
bootstrap(Constructor<?> constructor)
Defines the supplied constructor as a dynamic invocation bootstrap target for delegating advice methods.
|
Advice.WithCustomMapping |
bootstrap(Constructor<?> constructor,
Advice.BootstrapArgumentResolver.Factory resolverFactory)
Defines the supplied constructor as a dynamic invocation bootstrap target for delegating advice methods.
|
Advice.WithCustomMapping |
bootstrap(Method method)
Defines the supplied method as a dynamic invocation bootstrap target for delegating advice methods.
|
Advice.WithCustomMapping |
bootstrap(Method method,
Advice.BootstrapArgumentResolver.Factory resolver)
Defines the supplied method as a dynamic invocation bootstrap target for delegating advice methods.
|
Advice.WithCustomMapping |
bootstrap(MethodDescription.InDefinedShape bootstrap)
Defines the supplied method or constructor as a dynamic invocation bootstrap target for delegating advice methods.
|
Advice.WithCustomMapping |
bootstrap(MethodDescription.InDefinedShape bootstrap,
Advice.BootstrapArgumentResolver.Factory resolverFactory)
Defines the supplied method or constructor as a dynamic invocation bootstrap target for delegating advice methods.
|
Advice |
to(Class<?> advice)
Implements advice where every matched method is advised by the given type's advisory methods.
|
Advice |
to(Class<?> enterAdvice,
Class<?> exitAdvice)
Implements advice where every matched method is advised by the given type's advisory methods.
|
Advice |
to(Class<?> enterAdvice,
Class<?> exitAdvice,
ClassFileLocator classFileLocator)
Implements advice where every matched method is advised by the given type's advisory methods.
|
Advice |
to(Class<?> advice,
ClassFileLocator classFileLocator)
Implements advice where every matched method is advised by the given type's advisory methods.
|
Advice |
to(TypeDescription advice,
ClassFileLocator classFileLocator)
Implements advice where every matched method is advised by the given type's advisory methods.
|
Advice |
to(TypeDescription enterAdvice,
TypeDescription exitAdvice)
Implements advice where every matched method is advised by the given type's advisory methods.
|
Advice |
to(TypeDescription enterAdvice,
TypeDescription exitAdvice,
ClassFileLocator classFileLocator)
Implements advice where every matched method is advised by the given type's advisory methods.
|
Advice.WithCustomMapping |
with(Advice.PostProcessor.Factory postProcessorFactory)
Adds the supplied post processor factory for advice method post processing.
|
protected WithCustomMapping()
protected WithCustomMapping(Advice.PostProcessor.Factory postProcessorFactory, Map<Class<? extends Annotation>,Advice.OffsetMapping.Factory<?>> offsetMappings, Advice.Delegator.Factory delegatorFactory)
postProcessorFactory
- The post processor factory to apply.offsetMappings
- A map containing dynamically computed constant pool values that are mapped by their triggering annotation type.delegatorFactory
- The delegator factory to use.public <T extends Annotation> Advice.WithCustomMapping bind(Class<T> type, @MaybeNull Object value)
null
.T
- The annotation type.type
- The type of the annotation being bound.value
- The value to bind to the annotation or null
to bind the parameter type's default value.public <T extends Annotation> Advice.WithCustomMapping bind(Class<T> type, Field field)
T
- The annotation type.type
- The type of the annotation being bound.field
- The field to bind to this annotation.public <T extends Annotation> Advice.WithCustomMapping bind(Class<T> type, FieldDescription fieldDescription)
T
- The annotation type.type
- The type of the annotation being bound.fieldDescription
- The field to bind to this annotation.public <T extends Annotation> Advice.WithCustomMapping bind(Class<T> type, Method method, int index)
T
- The annotation type.type
- The type of the annotation being bound.method
- The method that defines the parameter.index
- The index of the parameter.public <T extends Annotation> Advice.WithCustomMapping bind(Class<T> type, Constructor<?> constructor, int index)
T
- The annotation type.type
- The type of the annotation being bound.constructor
- The constructor that defines the parameter.index
- The index of the parameter.public <T extends Annotation> Advice.WithCustomMapping bind(Class<T> type, ParameterDescription parameterDescription)
T
- The annotation type.type
- The type of the annotation being bound.parameterDescription
- The parameter for which to bind an argument.public <T extends Annotation> Advice.WithCustomMapping bind(Class<T> type, Class<?> value)
T
- The annotation type.type
- The type of the annotation being bound.value
- The type constant to bind.public <T extends Annotation> Advice.WithCustomMapping bind(Class<T> type, TypeDescription value)
T
- The annotation type.type
- The type of the annotation being bound.value
- The type constant to bind.public <T extends Annotation> Advice.WithCustomMapping bind(Class<T> type, Enum<?> value)
T
- The annotation type.type
- The type of the annotation being bound.value
- The enumeration constant to bind.public <T extends Annotation> Advice.WithCustomMapping bind(Class<T> type, EnumerationDescription value)
T
- The annotation type.type
- The type of the annotation being bound.value
- The enumeration constant to bind.public <T extends Annotation> Advice.WithCustomMapping bindSerialized(Class<T> type, Serializable value)
T
- The annotation type.type
- The type of the annotation being bound.value
- The value to bind to this annotation.public <T extends Annotation,S extends Serializable> Advice.WithCustomMapping bindSerialized(Class<T> type, S value, Class<? super S> targetType)
T
- The annotation type.S
- The type of the serialized instance.type
- The type of the annotation being bound.value
- The value to bind to this annotation.targetType
- The type of value
as which the instance should be treated.public <T extends Annotation> Advice.WithCustomMapping bindProperty(Class<T> type, String property)
T
- The annotation type.type
- The type of the annotation being bound.property
- The name of the annotation property to be bound.public <T extends Annotation> Advice.WithCustomMapping bind(Class<T> type, JavaConstant constant)
T
- The annotation type.type
- The type of the annotation being bound.constant
- The Java constant that is bound.public <T extends Annotation> Advice.WithCustomMapping bind(Class<T> type, ConstantValue constant)
T
- The annotation type.type
- The type of the annotation being bound.constant
- The constant value that is bound.public <T extends Annotation> Advice.WithCustomMapping bind(Class<T> type, StackManipulation stackManipulation, Type targetType)
T
- The annotation type.type
- The type of the annotation being bound.stackManipulation
- The stack manipulation loading the bound value.targetType
- The type of the loaded value.public <T extends Annotation> Advice.WithCustomMapping bind(Class<T> type, StackManipulation stackManipulation, TypeDescription.Generic targetType)
T
- The annotation type.type
- The type of the annotation being bound.stackManipulation
- The stack manipulation loading the bound value.targetType
- The type of the loaded value.public <T extends Annotation> Advice.WithCustomMapping bindLambda(Class<T> type, Constructor<?> constructor, Class<?> functionalInterface)
T
- The annotation type.type
- The type of the annotation being bound.constructor
- The constructor being bound as the lambda expression's implementation.functionalInterface
- The functional interface that represents the lambda expression.public <T extends Annotation> Advice.WithCustomMapping bindLambda(Class<T> type, Constructor<?> constructor, Class<?> functionalInterface, MethodGraph.Compiler methodGraphCompiler)
T
- The annotation type.type
- The type of the annotation being bound.constructor
- The constructor being bound as the lambda expression's implementation.functionalInterface
- The functional interface that represents the lambda expression.methodGraphCompiler
- The method graph compiler that resolves the functional method of the function interface.public <T extends Annotation> Advice.WithCustomMapping bindLambda(Class<T> type, Method method, Class<?> functionalInterface)
T
- The annotation type.type
- The type of the annotation being bound.method
- The method being bound as the lambda expression's implementation.functionalInterface
- The functional interface that represents the lambda expression.public <T extends Annotation> Advice.WithCustomMapping bindLambda(Class<T> type, Method method, Class<?> functionalInterface, MethodGraph.Compiler methodGraphCompiler)
T
- The annotation type.type
- The type of the annotation being bound.method
- The method being bound as the lambda expression's implementation.functionalInterface
- The functional interface that represents the lambda expression.methodGraphCompiler
- The method graph compiler that resolves the functional method of the function interface.public <T extends Annotation> Advice.WithCustomMapping bindLambda(Class<T> type, MethodDescription.InDefinedShape methodDescription, TypeDescription functionalInterface)
T
- The annotation type.type
- The type of the annotation being bound.methodDescription
- The method or constructor being bound as the lambda expression's implementation.functionalInterface
- The functional interface that represents the lambda expression.public <T extends Annotation> Advice.WithCustomMapping bindLambda(Class<T> type, MethodDescription.InDefinedShape methodDescription, TypeDescription functionalInterface, MethodGraph.Compiler methodGraphCompiler)
T
- The annotation type.type
- The type of the annotation being bound.methodDescription
- The method or constuctor being bound as the lambda expression's implementation.functionalInterface
- The functional interface that represents the lambda expression.methodGraphCompiler
- The method graph compiler that resolves the functional method of the function interface.public <T extends Annotation> Advice.WithCustomMapping bindDynamic(Class<T> type, Method bootstrapMethod, Object... constant)
T
- The annotation type.type
- The type of the annotation being bound.bootstrapMethod
- The bootstrap method returning the call site.constant
- The arguments supplied to the bootstrap method.public <T extends Annotation> Advice.WithCustomMapping bindDynamic(Class<T> type, Method bootstrapMethod, List<?> constants)
T
- The annotation type.type
- The type of the annotation being bound.bootstrapMethod
- The bootstrap method returning the call site.constants
- The arguments supplied to the bootstrap method.public <T extends Annotation> Advice.WithCustomMapping bindDynamic(Class<T> type, Constructor<?> bootstrapMethod, Object... constant)
T
- The annotation type.type
- The type of the annotation being bound.bootstrapMethod
- The bootstrap constructor returning the call site.constant
- The arguments supplied to the bootstrap method.public <T extends Annotation> Advice.WithCustomMapping bindDynamic(Class<T> type, Constructor<?> bootstrapMethod, List<?> constants)
T
- The annotation type.type
- The type of the annotation being bound.bootstrapMethod
- The bootstrap constructor returning the call site.constants
- The arguments supplied to the bootstrap method.public <T extends Annotation> Advice.WithCustomMapping bindDynamic(Class<T> type, MethodDescription.InDefinedShape bootstrapMethod, Object... constant)
T
- The annotation type.type
- The type of the annotation being bound.bootstrapMethod
- The bootstrap method or constructor returning the call site.constant
- The arguments supplied to the bootstrap method.public <T extends Annotation> Advice.WithCustomMapping bindDynamic(Class<T> type, MethodDescription.InDefinedShape bootstrapMethod, List<?> constants)
T
- The annotation type.type
- The type of the annotation being bound.bootstrapMethod
- The bootstrap method or constructor returning the call site.constants
- The arguments supplied to the bootstrap method.public <T extends Annotation> Advice.WithCustomMapping bind(Class<T> type, Advice.OffsetMapping offsetMapping)
T
- The annotation type.type
- The type of the annotation being bound.offsetMapping
- The offset mapping being bound.public Advice.WithCustomMapping bind(Advice.OffsetMapping.Factory<?> offsetMapping)
Advice
component discovers the given annotation on
a parameter of an advice method, the dynamic value is asked to provide a value that is then assigned to the parameter in question.offsetMapping
- The dynamic value that is computed for binding the parameter to a value.public Advice.WithCustomMapping bootstrap(Constructor<?> constructor)
java.lang.invoke.MethodHandles.Lookup
representing the source method.String
representing the constructor's internal name <init>
.java.lang.invoke.MethodType
representing the type that is requested for binding.String
of the target's binary class name.int
with value 0
for an enter advice and {code 1} for an exist advice.Class
representing the class implementing the instrumented method.String
with the name of the instrumented method.java.lang.invoke.MethodHandle
representing the instrumented method unless the target is the type's static initializer.constructor
- The bootstrap constructor.public Advice.WithCustomMapping bootstrap(Constructor<?> constructor, Advice.BootstrapArgumentResolver.Factory resolverFactory)
constructor
- The bootstrap constructor.resolverFactory
- A resolver factory to provide the arguments to the bootstrap method.public Advice.WithCustomMapping bootstrap(Method method)
java.lang.invoke.MethodHandles.Lookup
representing the source method.String
representing the method's name.java.lang.invoke.MethodType
representing the type that is requested for binding.String
of the target's binary class name.int
with value 0
for an enter advice and {code 1} for an exist advice.Class
representing the class implementing the instrumented method.String
with the name of the instrumented method.java.lang.invoke.MethodHandle
representing the instrumented method unless the target is the type's static initializer.method
- The bootstrap method.public Advice.WithCustomMapping bootstrap(Method method, Advice.BootstrapArgumentResolver.Factory resolver)
method
- The bootstrap method.resolver
- A resolver to provide the arguments to the bootstrap method.public Advice.WithCustomMapping bootstrap(MethodDescription.InDefinedShape bootstrap)
java.lang.invoke.MethodHandles.Lookup
representing the source method.String
representing the method's name or constructor's internal name <init>
.java.lang.invoke.MethodType
representing the type that is requested for binding.String
of the target's binary class name.int
with value 0
for an enter advice and {code 1} for an exist advice.Class
representing the class implementing the instrumented method.String
with the name of the instrumented method.java.lang.invoke.MethodHandle
representing the instrumented method unless the target is the type's static initializer.bootstrap
- The bootstrap method or constructor.public Advice.WithCustomMapping bootstrap(MethodDescription.InDefinedShape bootstrap, Advice.BootstrapArgumentResolver.Factory resolverFactory)
bootstrap
- The bootstrap method or constructor.resolverFactory
- A factory for a resolver to provide arguments to the bootstrap method.public Advice.WithCustomMapping with(Advice.PostProcessor.Factory postProcessorFactory)
postProcessorFactory
- The post processor factory to add.public Advice to(Class<?> advice)
advice
- The type declaring the advice.public Advice to(Class<?> advice, ClassFileLocator classFileLocator)
advice
- The type declaring the advice.classFileLocator
- The class file locator for locating the advisory class's class file.public Advice to(TypeDescription advice, ClassFileLocator classFileLocator)
advice
- A description of the type declaring the advice.classFileLocator
- The class file locator for locating the advisory class's class file.public Advice to(Class<?> enterAdvice, Class<?> exitAdvice)
enterAdvice
- The type declaring the enter advice.exitAdvice
- The type declaring the exit advice.public Advice to(Class<?> enterAdvice, Class<?> exitAdvice, ClassFileLocator classFileLocator)
enterAdvice
- The type declaring the enter advice.exitAdvice
- The type declaring the exit advice.classFileLocator
- The class file locator for locating the advisory class's class file.public Advice to(TypeDescription enterAdvice, TypeDescription exitAdvice)
false
are resolvable by the returned instance.enterAdvice
- The type declaring the enter advice.exitAdvice
- The type declaring the exit advice.public Advice to(TypeDescription enterAdvice, TypeDescription exitAdvice, ClassFileLocator classFileLocator)
enterAdvice
- The type declaring the enter advice.exitAdvice
- The type declaring the exit advice.classFileLocator
- The class file locator for locating the advisory class's class file.Copyright © 2014–2024. All rights reserved.