APIdia Launch Partner
Top Description Fields Constructors Methods
sun.reflect.annotation

public Class AnnotationType

extends Object
Class Inheritance
Imports
java.lang.annotation.*, java.lang.reflect.*, java.util.*, jdk.internal.access.SharedSecrets, .JavaLangAccess

Represents an annotation type at run time. Used to type-check annotations and apply member defaults.
Author
Josh Bloch
Since
1.5

Field Summary

Modifier and TypeField and Description
private final boolean
inherited

Whether this annotation type is inherited.

private final Map<String, Object>
memberDefaults

Member name -> default value mapping.

private final Map<String, Method>
members

Member name -> Method object mapping.

private final Map<String, Class<?>>
memberTypes

Member name -> type mapping.

private final RetentionPolicy
retention

The retention policy for this annotation type.

Constructor Summary

AccessConstructor and Description
private
AnnotationType(final Class<? extends Annotation>
the class object for the annotation type
annotationClass
)

Sole constructor.

Method Summary

Modifier and TypeMethod and Description
public static AnnotationType
getInstance(Class<? extends Annotation> annotationClass)

Returns an AnnotationType instance for the specified annotation type.

public 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).

public boolean
isInherited()

Returns true if this annotation type is inherited.

public Map<String, Object>
memberDefaults()

Returns the default values for this annotation type (Member name -> default value mapping).

public Map<String, Method>
members()

Returns members of this annotation type (member name -> associated Method object mapping).

public Map<String, Class<?>>
memberTypes()

Returns member types for this annotation type (member name -> type mapping).

public RetentionPolicy
retention()

Returns the retention policy for this annotation type.

public String
toString()

Overrides java.lang.Object.toString.

For debugging.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

inheritedback to summary
private final boolean inherited

Whether this annotation type is inherited.

memberDefaultsback to summary
private final Map<String, Object> memberDefaults

Member name -> default value mapping.

membersback to summary
private final Map<String, Method> members

Member name -> Method object mapping. This (and its associated accessor) are used only to generate AnnotationTypeMismatchExceptions.

memberTypesback to summary
private final Map<String, Class<?>> 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.

retentionback to summary
private final RetentionPolicy retention

The retention policy for this annotation type.

Constructor Detail

AnnotationTypeback to summary
private AnnotationType(final Class<? extends Annotation> annotationClass)

Sole constructor.

Parameters
annotationClass:Class<? extends Annotation>

the class object for the annotation type

Exceptions
IllegalArgumentException:
if the specified class object for does not represent a valid annotation type

Method Detail

getInstanceback to summary
public static AnnotationType getInstance(Class<? extends Annotation> annotationClass)

Returns an AnnotationType instance for the specified annotation type.

Exceptions
IllegalArgumentException:
if the specified class object does not represent a valid annotation type
invocationHandlerReturnTypeback to summary
public 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).

isInheritedback to summary
public boolean isInherited()

Returns true if this annotation type is inherited.

memberDefaultsback to summary
public Map<String, Object> memberDefaults()

Returns the default values for this annotation type (Member name -> default value mapping).

membersback to summary
public Map<String, Method> members()

Returns members of this annotation type (member name -> associated Method object mapping).

memberTypesback to summary
public Map<String, Class<?>> memberTypes()

Returns member types for this annotation type (member name -> type mapping).

retentionback to summary
public RetentionPolicy retention()

Returns the retention policy for this annotation type.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

For debugging.