| Modifier and Type | Field and Description |
|---|---|
| private static final Annotation[] | |
| private static final Annotation[] |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public static Annotation | annotationForMap(final Class<? extends Annotation> type, final Map<String, Object> memberValues)
Returns an annotation of the given type backed by the given member -> value map. |
| private static boolean | |
| private static ExceptionProxy | exceptionProxy(int tag)
Returns an appropriate exception proxy for a mismatching array annotation where the erroneous array has the specified tag. |
| pack-priv static Annotation[] | |
| pack-priv static Annotation | parseAnnotation(ByteBuffer buf, ConstantPool constPool, Class<?> container, boolean
if true, throw
TypeNotPresentException if a referenced annotation type is not
available at runtime exceptionOnMissingAnnotationClass)Parses the annotation at the current position in the specified byte buffer, resolving constant references in the specified constant pool. |
| private static Annotation | parseAnnotation2(ByteBuffer buf, ConstantPool constPool, Class<?> container, boolean exceptionOnMissingAnnotationClass, Class<? extends Annotation>[] selectAnnotationClasses)
|
| private static Object | parseAnnotationArray(int length, Class<? extends Annotation> annotationType, ByteBuffer buf, ConstantPool constPool, Class<?> container)
|
| public static Map | parseAnnotations(byte[] rawAnnotations, ConstantPool constPool, Class<?> container)
Parses the annotations described by the specified byte array. |
| private static Map | parseAnnotations2(byte[] rawAnnotations, ConstantPool constPool, Class<?> container, Class<? extends Annotation>[] selectAnnotationClasses)
|
| private static Object | parseArray(Class<?> arrayType, ByteBuffer buf, ConstantPool constPool, Class<?> container)
Parses the array value at the current position in the specified byte buffer, resolving constant references in the specified constant pool. |
| private static Object | |
| private static Object | |
| private static Object | |
| private static Object | |
| private static Object | |
| private static Object | parseClassValue(ByteBuffer buf, ConstantPool constPool, Class<?> container)
Parses the Class member value at the current position in the specified byte buffer, resolving constant references in the specified constant pool. |
| private static Object | parseConst(int tag, ByteBuffer buf, ConstantPool constPool)
Parses the primitive or String annotation member value indicated by the specified tag byte at the current position in the specified byte buffer, resolving constant reference in the specified constant pool. |
| private static Object | |
| private static Object | parseEnumArray(int length, Class<? extends Enum<?>> enumType, ByteBuffer buf, ConstantPool constPool, Class<?> container)
|
| private static Object | parseEnumValue(Class<? extends Enum<E extends Enum<E>>> enumType, ByteBuffer buf, ConstantPool constPool, Class<?> container)
Parses the enum constant member value at the current position in the specified byte buffer, resolving constant references in the specified constant pool. |
| private static Object | |
| private static Object | |
| private static Object | |
| 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. |
| public static Annotation[][] | parseParameterAnnotations(byte[] rawAnnotations, ConstantPool constPool, Class<?> container)
Parses the parameter annotations described by the specified byte array. |
| private static Annotation[][] | |
| public static Map | parseSelectAnnotations(byte[] rawAnnotations, ConstantPool constPool, Class<?> container, Class<? extends Annotation>...
an array of annotation types to select when parsing selectAnnotationClasses)Like |
| private static Object | |
| private static Class | |
| private static Object | |
| private static Object | |
| private static void | skipAnnotation(ByteBuffer buf, boolean
true if the byte buffer points to the beginning
of an annotation structure (rather than two bytes in). complete)Skips the annotation at the current position in the specified byte buffer. |
| private static void | skipArray(ByteBuffer buf)
Skips the array value at the current position in the specified byte buffer. |
| private static void | skipMemberValue(ByteBuffer buf)
Skips the annotation member value at the current position in the specified byte buffer. |
| private static void | skipMemberValue(int tag, ByteBuffer buf)
Skips the annotation member value at the current position in the specified byte buffer. |
| public static Annotation[] |
| EMPTY_ANNOTATION_ARRAY | back to summary |
|---|---|
| private static final Annotation[] EMPTY_ANNOTATION_ARRAY | |
| EMPTY_ANNOTATIONS_ARRAY | back to summary |
|---|---|
| private static final Annotation[] EMPTY_ANNOTATIONS_ARRAY | |
| AnnotationParser | back to summary |
|---|---|
| public AnnotationParser() | |
| annotationForMap | back to summary |
|---|---|
| public static Annotation annotationForMap(final Class<? extends Annotation> type, final Map<String, Object> memberValues) Returns an annotation of the given type backed by the given member -> value map. | |
| contains | back to summary |
|---|---|
| private static boolean contains(Object[] array, Object element) Searches for given | |
| exceptionProxy | back to summary |
|---|---|
| private static ExceptionProxy exceptionProxy(int tag) Returns an appropriate exception proxy for a mismatching array annotation where the erroneous array has the specified tag. | |
| getEmptyAnnotationArray | back to summary |
|---|---|
| pack-priv static Annotation[] getEmptyAnnotationArray() | |
| parseAnnotation | back to summary |
|---|---|
| pack-priv static Annotation parseAnnotation(ByteBuffer buf, ConstantPool constPool, Class<?> container, boolean exceptionOnMissingAnnotationClass) Parses the annotation 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 an "annotation structure" as described in the RuntimeVisibleAnnotations_attribute: annotation { u2 type_index; u2 num_member_value_pairs; { u2 member_name_index; member_value value; } member_value_pairs[num_member_value_pairs]; } } Returns the annotation, or null if the annotation's type cannot be found by the VM, or is not a valid annotation type.
| |
| parseAnnotation2 | back to summary |
|---|---|
private static Annotation parseAnnotation2(ByteBuffer buf, ConstantPool constPool, Class<?> container, boolean exceptionOnMissingAnnotationClass, Class<? extends Annotation>[] selectAnnotationClasses)
| |
| parseAnnotationArray | back to summary |
|---|---|
| private static Object parseAnnotationArray(int length, Class<? extends Annotation> annotationType, ByteBuffer buf, ConstantPool constPool, Class<?> container) | |
| parseAnnotations | back to summary |
|---|---|
| public static Map 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];
| |
| parseAnnotations2 | back to summary |
|---|---|
| private static Map | |
| parseArray | back to summary |
|---|---|
| private static Object parseArray(Class<?> arrayType, ByteBuffer buf, ConstantPool constPool, Class<?> container) Parses the array 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 an array value struct as specified in the RuntimeVisibleAnnotations_attribute: { u2 num_values; member_value values[num_values]; } array_value; If the array values do not match arrayType, an AnnotationTypeMismatchExceptionProxy will be returned.
| |
| parseArrayElements | back to summary |
|---|---|
| private static Object parseArrayElements(Object[] result, ByteBuffer buf, int expectedTag, Supplier<Object> parseElement) | |
| parseBooleanArray | back to summary |
|---|---|
| private static Object parseBooleanArray(int length, ByteBuffer buf, ConstantPool constPool) | |
| parseByteArray | back to summary |
|---|---|
| private static Object parseByteArray(int length, ByteBuffer buf, ConstantPool constPool) | |
| parseCharArray | back to summary |
|---|---|
| private static Object parseCharArray(int length, ByteBuffer buf, ConstantPool constPool) | |
| parseClassArray | back to summary |
|---|---|
| private static Object parseClassArray(int length, ByteBuffer buf, ConstantPool constPool, Class<?> container) | |
| parseClassValue | back to summary |
|---|---|
| private static Object parseClassValue(ByteBuffer buf, ConstantPool constPool, Class<?> container) Parses the Class 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 "class info index" as described in the RuntimeVisibleAnnotations_attribute: u2 class_info_index; | |
| parseConst | back to summary |
|---|---|
| private static Object parseConst(int tag, ByteBuffer buf, ConstantPool constPool) Parses the primitive or String annotation member value indicated by the specified tag byte at the current position in the specified byte buffer, resolving constant reference in the specified constant pool. The cursor of the byte buffer must point to an annotation member value of the type indicated by the specified tag, as described in the RuntimeVisibleAnnotations_attribute: u2 const_value_index; | |
| parseDoubleArray | back to summary |
|---|---|
| private static Object parseDoubleArray(int length, ByteBuffer buf, ConstantPool constPool) | |
| parseEnumArray | back to summary |
|---|---|
| private static Object parseEnumArray(int length, Class<? extends Enum<?>> enumType, ByteBuffer buf, ConstantPool constPool, Class<?> container) | |
| parseEnumValue | back to summary |
|---|---|
| private static Object parseEnumValue(Class<? extends Enum<E extends Enum<E>>> enumType, ByteBuffer buf, ConstantPool constPool, Class<?> container) Parses the enum constant 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 "enum_const_value structure" as described in the RuntimeVisibleAnnotations_attribute: { u2 type_name_index; u2 const_name_index; } enum_const_value;
| |
| parseFloatArray | back to summary |
|---|---|
| private static Object parseFloatArray(int length, ByteBuffer buf, ConstantPool constPool) | |
| parseIntArray | back to summary |
|---|---|
| private static Object parseIntArray(int length, ByteBuffer buf, ConstantPool constPool) | |
| parseLongArray | back to summary |
|---|---|
| private static Object parseLongArray(int length, ByteBuffer buf, ConstantPool constPool) | |
| parseMemberValue | back to summary |
|---|---|
| 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.
| |
| parseParameterAnnotations | back to summary |
|---|---|
| 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.
| |
| parseParameterAnnotations2 | back to summary |
|---|---|
| private static Annotation[][] parseParameterAnnotations2(byte[] rawAnnotations, ConstantPool constPool, Class<?> container) | |
| parseSelectAnnotations | back to summary |
|---|---|
| public static Map Like
This method is used to parse select meta annotations in the construction
phase of
| |
| parseShortArray | back to summary |
|---|---|
| private static Object parseShortArray(int length, ByteBuffer buf, ConstantPool constPool) | |
| parseSig | back to summary |
|---|---|
| private static Class | |
| parseStringArray | back to summary |
|---|---|
| private static Object parseStringArray(int length, ByteBuffer buf, ConstantPool constPool) | |
| parseUnknownArray | back to summary |
|---|---|
| private static Object parseUnknownArray(int length, ByteBuffer buf) | |
| skipAnnotation | back to summary |
|---|---|
| private static void skipAnnotation(ByteBuffer buf, boolean complete) Skips the annotation at the current position in the specified byte buffer. The cursor of the byte buffer must point to an "annotation structure" OR two bytes into an annotation structure (i.e., after the type index).
| |
| skipArray | back to summary |
|---|---|
| private static void skipArray(ByteBuffer buf) Skips the array value at the current position in the specified byte buffer. The cursor of the byte buffer must point to an array value struct. | |
| skipMemberValue | back to summary |
|---|---|
| private static void skipMemberValue(ByteBuffer buf) Skips the annotation member value at the current position in the specified byte buffer. The cursor of the byte buffer must point to a "member_value structure." | |
| skipMemberValue | back to summary |
|---|---|
| private static void skipMemberValue(int tag, ByteBuffer buf) Skips the annotation member value at the current position in the specified byte buffer. The cursor of the byte buffer must point immediately after the tag in a "member_value structure." | |
| toArray | back to summary |
|---|---|
| public static Annotation[] toArray(Map<Class<? extends Annotation>, Annotation> annotations) | |