Home » openjdk-7 » sun » reflect » annotation » [javadoc | source]
sun.reflect.annotation
public class: AnnotationParser [javadoc | source]
java.lang.Object
   sun.reflect.annotation.AnnotationParser
Parser for Java programming language annotations. Translates annotation byte streams emitted by compiler into annotation objects.
Method from sun.reflect.annotation.AnnotationParser Summary:
annotationForMap,   parseAnnotations,   parseMemberValue,   parseParameterAnnotations,   toArray,   toClass
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from sun.reflect.annotation.AnnotationParser Detail:
 public static Annotation annotationForMap(Class<Annotation> type,
    Map<String, Object> memberValues) 
    Returns an annotation of the given type backed by the given member -> value map.
 public static Map<Annotation, Annotation> parseAnnotations(byte[] rawAnnotations,
    ConstantPool constPool,
    Class<?> container) 
    Parses the annotations described by the specified byte array. resolving constant references in the specified constant pool. The array must contain an array of annotations as described in the RuntimeVisibleAnnotations_attribute: u2 num_annotations; annotation annotations[num_annotations];
 public static Object parseMemberValue(Class<?> memberType,
    ByteBuffer buf,
    ConstantPool constPool,
    Class<?> container) 
    Parses the annotation member value at the current position in the specified byte buffer, resolving constant references in the specified constant pool. The cursor of the byte buffer must point to a "member_value structure" as described in the RuntimeVisibleAnnotations_attribute: member_value { u1 tag; union { u2 const_value_index; { u2 type_name_index; u2 const_name_index; } enum_const_value; u2 class_info_index; annotation annotation_value; { u2 num_values; member_value values[num_values]; } array_value; } value; } The member must be of the indicated type. If it is not, this method returns an AnnotationTypeMismatchExceptionProxy.
 public static Annotation[][] parseParameterAnnotations(byte[] rawAnnotations,
    ConstantPool constPool,
    Class<?> container) 
    Parses the parameter annotations described by the specified byte array. resolving constant references in the specified constant pool. The array must contain an array of annotations as described in the RuntimeVisibleParameterAnnotations_attribute: u1 num_parameters; { u2 num_annotations; annotation annotations[num_annotations]; } parameter_annotations[num_parameters]; Unlike parseAnnotations, rawAnnotations must not be null! A null value must be handled by the caller. This is so because we cannot determine the number of parameters if rawAnnotations is null. Also, the caller should check that the number of parameters indicated by the return value of this method matches the actual number of method parameters. A mismatch indicates that an AnnotationFormatError should be thrown.
 public static Annotation[] toArray(Map<Annotation, Annotation> annotations) 
 static Class<?> toClass(Type o)