Class AnnotationDescription.AnnotationInvocationHandler<T extends Annotation>
java.lang.Object
net.bytebuddy.description.annotation.AnnotationDescription.AnnotationInvocationHandler<T>
- Type Parameters:
T- The type of the handled annotation.
- All Implemented Interfaces:
InvocationHandler
- Enclosing interface:
AnnotationDescription
public static class AnnotationDescription.AnnotationInvocationHandler<T extends Annotation>
extends Object
implements InvocationHandler
An
InvocationHandler for implementing annotations.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final StringThe name of theAnnotation.annotationType()method.private final Class<? extends Annotation> The loaded annotation type.private static final StringThe name of theObject.equals(Object)method.private static final StringThe name of theObject.hashCode()method.private static final Object[]An empty array that can be used to indicate no arguments to avoid an allocation on a reflective call.private static final StringThe name of theObject.toString()method.private final LinkedHashMap<Method, AnnotationValue.Loaded<?>> A sorted list of values of this annotation. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAnnotationInvocationHandler(Class<T> annotationType, LinkedHashMap<Method, AnnotationValue.Loaded<?>> values) Creates a new invocation handler. -
Method Summary
Modifier and TypeMethodDescriptionbooleanprivate booleanequalsRepresentation(Object self, Object other) Checks if another instance is equal to this instance.inthashCode()private intReturns the hash code of the represented annotation.static <S extends Annotation>
Sof(ClassLoader classLoader, Class<S> annotationType, Map<String, ? extends AnnotationValue<?, ?>> values) Creates a proxy instance for the supplied annotation type and values.protected StringReturns the string representation of the represented annotation.
-
Field Details
-
HASH_CODE
The name of theObject.hashCode()method.- See Also:
-
EQUALS
The name of theObject.equals(Object)method.- See Also:
-
TO_STRING
The name of theObject.toString()method.- See Also:
-
ANNOTATION_TYPE
The name of theAnnotation.annotationType()method.- See Also:
-
NO_ARGUMENT
An empty array that can be used to indicate no arguments to avoid an allocation on a reflective call. -
annotationType
The loaded annotation type. -
values
A sorted list of values of this annotation.
-
-
Constructor Details
-
AnnotationInvocationHandler
protected AnnotationInvocationHandler(Class<T> annotationType, LinkedHashMap<Method, AnnotationValue.Loaded<?>> values) Creates a new invocation handler.- Parameters:
annotationType- The loaded annotation type.values- A sorted list of values of this annotation.
-
-
Method Details
-
of
public static <S extends Annotation> S of(@MaybeNull ClassLoader classLoader, Class<S> annotationType, Map<String, ? extends AnnotationValue<?, ?>> values) Creates a proxy instance for the supplied annotation type and values.- Type Parameters:
S- The type of the handled annotation.- Parameters:
classLoader- The class loader that should be used for loading the annotation's values.annotationType- The annotation's type.values- The values that the annotation contains.- Returns:
- A proxy for the annotation type and values.
-
invoke
- Specified by:
invokein interfaceInvocationHandler
-
toStringRepresentation
Returns the string representation of the represented annotation.- Returns:
- The string representation of the represented annotation.
-
hashCodeRepresentation
private int hashCodeRepresentation()Returns the hash code of the represented annotation.- Returns:
- The hash code of the represented annotation.
-
equalsRepresentation
Checks if another instance is equal to this instance.- Parameters:
self- The annotation proxy instance.other- The instance to be examined for equality to the represented instance.- Returns:
trueif the given instance is equal to the represented instance.
-
hashCode
-
equals
-