Package com.strobel.reflection.emit
Class AnnotationType
java.lang.Object
com.strobel.reflection.emit.AnnotationType
Represents an annotation type at run time. Used to type-check annotations
and apply member defaults.
- Since:
- 1.5
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final ClassValue
<AnnotationType> private final boolean
Whether this annotation type is inherited.Member name -> default value mapping.Member name -> Method object mapping.Member name -> type mapping.private final RetentionPolicy
The retention policy for this annotation type. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
AnnotationType
(Class<? extends Annotation> annotationClass) Sole constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic AnnotationType
getInstance
(Class<? extends Annotation> annotationClass) Returns an AnnotationType instance for the specified annotation type.static Class
<?> invocationHandlerReturnType
(Class<?> type) Returns the type that must be returned by the invocation handler of a dynamic proxy in order to have the dynamic proxy return the specified type (which is assumed to be a legal member type for an annotation).boolean
Returns true if this annotation type is inherited.Returns the default values for this annotation type (Member name -> default value mapping).members()
Returns members of this annotation type (member name -> associated Method object mapping).Returns member types for this annotation type (member name -> type mapping).Returns the retention policy for this annotation type.toString()
For debugging.
-
Field Details
-
ANNOTATION_TYPES
-
memberTypes
Member name -> type mapping. Note that primitive types are represented by the class objects for the corresponding wrapper types. This matches the return value that must be used for a dynamic proxy, allowing for a simple isInstance test. -
memberDefaults
Member name -> default value mapping. -
members
Member name -> Method object mapping. This (and its associated accessor) are used only to generate AnnotationTypeMismatchExceptions. -
retention
The retention policy for this annotation type. -
inherited
private final boolean inheritedWhether this annotation type is inherited.
-
-
Constructor Details
-
AnnotationType
Sole constructor.- Parameters:
annotationClass
- the class object for the annotation type- Throws:
IllegalArgumentException
- if the specified class object for does not represent a valid annotation type
-
-
Method Details
-
getInstance
Returns an AnnotationType instance for the specified annotation type.- Throws:
IllegalArgumentException
- if the specified class object for does not represent a valid annotation type
-
invocationHandlerReturnType
Returns the type that must be returned by the invocation handler of a dynamic proxy in order to have the dynamic proxy return the specified type (which is assumed to be a legal member type for an annotation). -
memberTypes
Returns member types for this annotation type (member name -> type mapping). -
members
Returns members of this annotation type (member name -> associated Method object mapping). -
memberDefaults
Returns the default values for this annotation type (Member name -> default value mapping). -
retention
Returns the retention policy for this annotation type. -
isInherited
public boolean isInherited()Returns true if this annotation type is inherited. -
toString
For debugging.
-