Represents an annotation type at run time. Used to type-check annotations
and apply member defaults.
| Method from sun.reflect.annotation.AnnotationType Detail: |
public static synchronized AnnotationType getInstance(Class annotationClass) {
AnnotationType result = sun.misc.SharedSecrets.getJavaLangAccess().
getAnnotationType(annotationClass);
if (result == null)
result = new AnnotationType((Class< ? >) annotationClass);
return result;
}
Returns an AnnotationType instance for the specified annotation type. |
public static Class invocationHandlerReturnType(Class type) {
// Translate primitives to wrappers
if (type == byte.class)
return Byte.class;
if (type == char.class)
return Character.class;
if (type == double.class)
return Double.class;
if (type == float.class)
return Float.class;
if (type == int.class)
return Integer.class;
if (type == long.class)
return Long.class;
if (type == short.class)
return Short.class;
if (type == boolean.class)
return Boolean.class;
// Otherwise, just return declared type
return 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() {
return inherited;
}
Returns true if this this annotation type is inherited. |
public Map memberDefaults() {
return memberDefaults;
}
Returns the default values for this annotation type
(Member name -> default value mapping). |
public Map memberTypes() {
return memberTypes;
}
Returns member types for this annotation type
(member name -> type mapping). |
public Map members() {
return members;
}
Returns members of this annotation type
(member name -> associated Method object mapping). |
public RetentionPolicy retention() {
return retention;
}
Returns the retention policy for this annotation type. |
public String toString() {
StringBuffer s = new StringBuffer("Annotation Type:" + "\n");
s.append(" Member types: " + memberTypes + "\n");
s.append(" Member defaults: " + memberDefaults + "\n");
s.append(" Retention policy: " + retention + "\n");
s.append(" Inherited: " + inherited);
return s.toString();
}
|