Class ParseAnnotation
ParserAnnotation is a parser class owned by Parser.java. It is primarily responsible for parsing Annotations (for classes, methods or fields).
ParserAnnotation can parse the different types of Annotation Attributes: Runtime(In)Visible Annotations (JDK 6+) Default Annotations (JDK 6+) Runtime(In)VisibleParameter Annotations (JDK 7+) Runtime(In)VisibleType Annotations (JSR308, JDK8+)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static classAnnotationElemValue - used to store Annotation values(package private) static classAnnotation Element value referring to an Array(package private) static classAnnotation Element value referring to a class(package private) static classAnnotation Element value referring to a Constant(package private) static classElement Value for Enumsprivate static classTarget Type visitor, used for constructing the target-info within a type annotation. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final ParseAnnotation.TargetTypeVisitorlocal handles on the scanner, main parser, and the error reporting envFields inherited from class ParseBase
debugFlag, environment, parser, scanner -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void_scanAnnotation(AnnotationData annotData) Parses an individual annotation-data.private void_scanTargetPath(TypeAnnotationData annotData) _scanTargetPath_scanTypeLocationprivate void_scanTypeTarget(TypeAnnotationData annotData) Parses an individual annotation-data.private DataWritergetElementValueByCPIndex(int cpIndex) private AnnotationDataParses an individual annotation.(package private) ArrayList<AnnotationData> The main entry for parsing an annotation list.protected DefaultAnnotationAttrparseDefaultAnnotationprotected voidparseParamAnnotation(int totalParams, MethodData curMethod) Parses Parameter Annotations attributes.private AnnotationDataparseTypeAnnotation - parses an individual annotation.private ParseAnnotation.ArrayElemValuescanAnnotationArray(String name) scanAnnotationArrayprivate DataWriterscanAnnotationClass(String name) Scans an annotation enumeration.private DataWriterscanAnnotationData(String name) scanAnnotationDataprivate ParseAnnotation.EnumElemValuescanAnnotationEnum(String name) Scans an annotation enum val.private DataWriterscanAnnotationIdent(String ident, String name) scanAnnotationIdentprotected voidscanParamName(int totalParams, int paramNum, MethodData curMethod) Methods inherited from class ParseBase
init, init, init, setDebugFlag, traceMethodInfoLn, traceMethodInfoLn, traceMethodInfoLn
-
Field Details
-
targetTypeVisitor
local handles on the scanner, main parser, and the error reporting env
-
-
Constructor Details
-
ParseAnnotation
-
-
Method Details
-
scanParamName
protected void scanParamName(int totalParams, int paramNum, MethodData curMethod) throws SyntaxError - Throws:
SyntaxError
-
parseAnnotations
The main entry for parsing an annotation list.- Returns:
- An ArrayList of parsed annotations
- Throws:
SyntaxError
-
parseDefaultAnnotation
parseDefaultAnnotationparses a default Annotation attribute
- Returns:
- the parsed Annotation Attribute
- Throws:
SyntaxErrorSyntaxError- if a scanner error occurs
-
parseParamAnnotation
Parses Parameter Annotations attributes.- Parameters:
totalParams-curMethod-- Throws:
SyntaxError- if a scanner error occurs
-
parseTypeAnnotation
parseTypeAnnotation - parses an individual annotation.- Returns:
- a parsed annotation.
- Throws:
SyntaxError- if a scanner error occurs
-
parseAnnotation
Parses an individual annotation.- Returns:
- a parsed annotation.
- Throws:
SyntaxError- if a scanner error occurs
-
_scanAnnotation
Parses an individual annotation-data.- Throws:
SyntaxError- if a scanner error occurs
-
_scanTypeTarget
Parses an individual annotation-data.- Throws:
SyntaxError- if a scanner error occurs
-
_scanTargetPath
_scanTargetPathparses and fills the type_path structure (4.7.20.2)
type_path { u1 path_length; { u1 type_path_kind; u1 type_argument_index; } path[path_length]; }
- Throws:
SyntaxError- if a scanner error occurs
-
_scanTypePathEntry
_scanTypeLocationparses a path entry of the type_path.
{ u1 type_path_kind; u1 type_argument_index; }
- Returns:
- a parsed type path.
- Throws:
SyntaxError- if a scanner error occurs
-
scanAnnotationArray
scanAnnotationArrayScans an Array of annotations.
- Parameters:
name- Name of the annotation- Returns:
- Array Element
- Throws:
SyntaxError- if a scanner error occurs
-
scanAnnotationClass
Scans an annotation enumeration.- Parameters:
name- Annotation Name- Returns:
- Constant element value for the Class Annotation.
- Throws:
SyntaxError- if a scanner error occurs
-
scanAnnotationEnum
Scans an annotation enum val.- Parameters:
name- Annotation Name- Returns:
- Enumeration Element Value
- Throws:
SyntaxError- if a scanner error occurs
-
scanAnnotationData
scanAnnotationDataparses the internals of an annotation.
- Parameters:
name- Annotation Name- Returns:
- a Data data structure containing the annotation data.
- Throws:
IOException- for scanning errors.
-
getElementValueByCPIndex
-
scanAnnotationIdent
scanAnnotationIdentparses the identifier of an annotation.
- Parameters:
ident- Basic Type identifiername- Annotation Name- Returns:
- Basic Type Annotation data
- Throws:
SyntaxError- if a scanning error occurs
-