Class TargetMethodAnnotationDrivenBinder.ParameterBinder.ForFixedValue.OfConstant<U extends java.lang.annotation.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 java.lang.annotation.Annotation>
@Enhance public static class TargetMethodAnnotationDrivenBinder.ParameterBinder.ForFixedValue.OfConstant<U extends java.lang.annotation.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 asTypeDescription
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 unloadedJavaConstant
representations.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.bytebuddy.implementation.bind.annotation.TargetMethodAnnotationDrivenBinder.ParameterBinder.ForFixedValue
TargetMethodAnnotationDrivenBinder.ParameterBinder.ForFixedValue.OfConstant<U extends java.lang.annotation.Annotation>
-
Nested classes/interfaces inherited from interface net.bytebuddy.implementation.bind.annotation.TargetMethodAnnotationDrivenBinder.ParameterBinder
TargetMethodAnnotationDrivenBinder.ParameterBinder.ForFieldBinding<S extends java.lang.annotation.Annotation>, TargetMethodAnnotationDrivenBinder.ParameterBinder.ForFixedValue<S extends java.lang.annotation.Annotation>
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Class<U>
type
The type of the annotation that is bound by this binder.private java.lang.Object
value
The value that is assigned to any annotated parameter.-
Fields inherited from interface net.bytebuddy.implementation.bind.annotation.TargetMethodAnnotationDrivenBinder.ParameterBinder
DEFAULTS
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
OfConstant(java.lang.Class<U> type, java.lang.Object value)
Creates a binder for binding a fixed value to a parameter annotated with the given annotation.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.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
.java.lang.Class<U>
getHandledType()
The annotation type that is handled by this parameter binder.static <V extends java.lang.annotation.Annotation>
TargetMethodAnnotationDrivenBinder.ParameterBinder<V>of(java.lang.Class<V> type, java.lang.Object value)
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 Detail
-
type
private final java.lang.Class<U extends java.lang.annotation.Annotation> type
The type of the annotation that is bound by this binder.
-
value
@ValueHandling(REVERSE_NULLABILITY) private final java.lang.Object value
The value that is assigned to any annotated parameter.
-
-
Constructor Detail
-
OfConstant
protected OfConstant(java.lang.Class<U> type, java.lang.Object value)
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 Detail
-
of
public static <V extends java.lang.annotation.Annotation> TargetMethodAnnotationDrivenBinder.ParameterBinder<V> of(java.lang.Class<V> type, java.lang.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
public java.lang.Class<U> getHandledType()
The annotation type that is handled by this parameter binder.- Returns:
- The
Annotation.annotationType()
handled by this parameter binder.
-
bind
protected java.lang.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 java.lang.annotation.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.
-
-