Class TargetMethodAnnotationDrivenBinder.ParameterBinder.ForFixedValue.OfConstant<U extends Annotation>
java.lang.Object
net.bytebuddy.implementation.bind.annotation.TargetMethodAnnotationDrivenBinder.ParameterBinder.ForFixedValue<U>
net.bytebuddy.implementation.bind.annotation.TargetMethodAnnotationDrivenBinder.ParameterBinder.ForFixedValue.OfConstant<U>
- Type Parameters:
U
- The bound annotation's type.
- All Implemented Interfaces:
TargetMethodAnnotationDrivenBinder.ParameterBinder<U>
- Enclosing class:
TargetMethodAnnotationDrivenBinder.ParameterBinder.ForFixedValue<S extends Annotation>
@Enhance
public static class TargetMethodAnnotationDrivenBinder.ParameterBinder.ForFixedValue.OfConstant<U extends Annotation>
extends TargetMethodAnnotationDrivenBinder.ParameterBinder.ForFixedValue<U>
A parameter binder that binds a fixed value to a parameter annotation when using a MethodDelegation
.
This binder is only capable to store
values that can either be expressed as Java byte code or as a constant pool value. This includes primitive types, String
values,
Class
values which can also be expressed as TypeDescription
instances or method handles and method types for classes of
a version at least of Java 7. The latter instances can also be expressed as unloaded JavaConstant
representations.
-
Nested Class Summary
Nested classes/interfaces inherited from class net.bytebuddy.implementation.bind.annotation.TargetMethodAnnotationDrivenBinder.ParameterBinder.ForFixedValue
TargetMethodAnnotationDrivenBinder.ParameterBinder.ForFixedValue.OfConstant<U extends Annotation>
Nested classes/interfaces inherited from interface net.bytebuddy.implementation.bind.annotation.TargetMethodAnnotationDrivenBinder.ParameterBinder
TargetMethodAnnotationDrivenBinder.ParameterBinder.ForFieldBinding<S extends Annotation>, TargetMethodAnnotationDrivenBinder.ParameterBinder.ForFixedValue<S extends Annotation>
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe type of the annotation that is bound by this binder.private final Object
The value that is assigned to any annotated parameter.Fields inherited from interface net.bytebuddy.implementation.bind.annotation.TargetMethodAnnotationDrivenBinder.ParameterBinder
DEFAULTS
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
OfConstant
(Class<U> type, Object value) Creates a binder for binding a fixed value to a parameter annotated with the given annotation. -
Method Summary
Modifier and TypeMethodDescriptionprotected Object
bind
(AnnotationDescription.Loadable<U> annotation, MethodDescription source, ParameterDescription target) Resolves a value for the given annotation on a parameter that is processed by aMethodDelegation
.The annotation type that is handled by this parameter binder.static <V extends Annotation>
TargetMethodAnnotationDrivenBinder.ParameterBinder<V> Creates a binder for binding a fixed value to a given annotation.Methods inherited from class net.bytebuddy.implementation.bind.annotation.TargetMethodAnnotationDrivenBinder.ParameterBinder.ForFixedValue
bind
-
Field Details
-
type
The type of the annotation that is bound by this binder. -
value
The value that is assigned to any annotated parameter.
-
-
Constructor Details
-
OfConstant
Creates a binder for binding a fixed value to a parameter annotated with the given annotation.- Parameters:
type
- The type of the annotation that is bound by this binder.value
- The value that is assigned to any annotated parameter.
-
-
Method Details
-
of
public static <V extends Annotation> TargetMethodAnnotationDrivenBinder.ParameterBinder<V> of(Class<V> type, @MaybeNull Object value) Creates a binder for binding a fixed value to a given annotation.- Type Parameters:
V
- The bound annotation's type.- Parameters:
type
- The type of the annotation that is bound by this binder.value
- The value that is assigned to any annotated parameter.- Returns:
- A parameter binder that binds the given annotation to the supplied value.
-
getHandledType
The annotation type that is handled by this parameter binder.- Returns:
- The
Annotation.annotationType()
handled by this parameter binder.
-
bind
@MaybeNull protected Object bind(AnnotationDescription.Loadable<U> annotation, MethodDescription source, ParameterDescription target) Description copied from class:TargetMethodAnnotationDrivenBinder.ParameterBinder.ForFixedValue
Resolves a value for the given annotation on a parameter that is processed by aMethodDelegation
.- Specified by:
bind
in classTargetMethodAnnotationDrivenBinder.ParameterBinder.ForFixedValue<U extends Annotation>
- Parameters:
annotation
- The annotation that triggered this binding.source
- The method for which a delegation is currently bound.target
- The parameter for which a value is bound.- Returns:
- The constant pool value that is bound to this parameter or
null
for binding this value.
-