public class GroovyAnnotationMetadataBuilder extends AbstractAnnotationMetadataBuilder<org.codehaus.groovy.ast.AnnotatedNode,org.codehaus.groovy.ast.AnnotationNode>
AbstractAnnotationMetadataBuilder
.Modifier and Type | Field and Description |
---|---|
static org.codehaus.groovy.ast.ClassNode |
ANN_OVERRIDE |
static String |
VALIDATOR_KEY |
Constructor and Description |
---|
GroovyAnnotationMetadataBuilder(org.codehaus.groovy.control.SourceUnit sourceUnit,
org.codehaus.groovy.control.CompilationUnit compilationUnit) |
Modifier and Type | Method and Description |
---|---|
protected void |
addError(org.codehaus.groovy.ast.AnnotatedNode originatingElement,
String error)
Adds an error.
|
protected void |
addWarning(org.codehaus.groovy.ast.AnnotatedNode originatingElement,
String warning)
Adds an warning.
|
protected List<org.codehaus.groovy.ast.AnnotatedNode> |
buildHierarchy(org.codehaus.groovy.ast.AnnotatedNode element,
boolean inheritTypeAnnotations,
boolean declaredOnly)
Build the type hierarchy for the given element.
|
protected VisitorContext |
createVisitorContext()
Creates the visitor context for this implementation.
|
protected org.codehaus.groovy.ast.AnnotatedNode |
getAnnotationMember(org.codehaus.groovy.ast.AnnotatedNode originatingElement,
CharSequence member)
Get the annotation member.
|
protected String |
getAnnotationMemberName(org.codehaus.groovy.ast.AnnotatedNode member)
Read the name of an annotation member.
|
protected Map<String,? extends org.codehaus.groovy.ast.AnnotatedNode> |
getAnnotationMembers(String annotationType)
Gets the annotation members for the given type.
|
protected Optional<org.codehaus.groovy.ast.AnnotatedNode> |
getAnnotationMirror(String annotationName)
Return a mirror for the given annotation.
|
protected List<? extends org.codehaus.groovy.ast.AnnotationNode> |
getAnnotationsForType(org.codehaus.groovy.ast.AnnotatedNode element)
Obtain the annotations for the given type.
|
protected String |
getAnnotationTypeName(org.codehaus.groovy.ast.AnnotationNode annotationMirror)
Get the given type of the annotation.
|
protected OptionalValues<?> |
getAnnotationValues(org.codehaus.groovy.ast.AnnotatedNode originatingElement,
org.codehaus.groovy.ast.AnnotatedNode member,
Class<?> annotationType)
Resolve the annotations values from the given member for the given type.
|
protected String |
getDeclaringType(org.codehaus.groovy.ast.AnnotatedNode element)
Obtains the declaring type for an element.
|
protected String |
getElementName(org.codehaus.groovy.ast.AnnotatedNode element)
Get the name for the given element.
|
protected AnnotatedElementValidator |
getElementValidator()
Obtains the element validator.
|
protected String |
getRepeatableName(org.codehaus.groovy.ast.AnnotationNode annotationMirror)
Obtain the name of the repeatable annotation if the annotation is is one.
|
protected String |
getRepeatableNameForType(org.codehaus.groovy.ast.AnnotatedNode annotationType)
Obtain the name of the repeatable annotation if the annotation is is one.
|
protected RetentionPolicy |
getRetentionPolicy(org.codehaus.groovy.ast.AnnotatedNode annotation)
Gets the retention policy for the given annotation.
|
protected org.codehaus.groovy.ast.AnnotatedNode |
getTypeForAnnotation(org.codehaus.groovy.ast.AnnotationNode annotationMirror)
Get the type of the given annotation.
|
protected boolean |
hasAnnotation(org.codehaus.groovy.ast.AnnotatedNode element,
Class<? extends Annotation> annotation)
Checks whether an annotation is present.
|
protected boolean |
hasAnnotation(org.codehaus.groovy.ast.AnnotatedNode element,
String annotation)
Checks whether an annotation is present.
|
protected boolean |
hasAnnotations(org.codehaus.groovy.ast.AnnotatedNode element)
Checks whether any annotations are present on the given element.
|
protected boolean |
hasSimpleAnnotation(org.codehaus.groovy.ast.AnnotatedNode element,
String simpleName)
Returns true if a simple meta annotation is present for the given element and annotation type.
|
protected boolean |
isExcludedAnnotation(org.codehaus.groovy.ast.AnnotatedNode element,
String annotationName)
Is the given annotation excluded for the specified element.
|
protected boolean |
isInheritedAnnotation(org.codehaus.groovy.ast.AnnotationNode annotationMirror)
Test whether the annotation mirror is inherited.
|
protected boolean |
isInheritedAnnotationType(org.codehaus.groovy.ast.AnnotatedNode annotationType)
Test whether the annotation mirror is inherited.
|
protected boolean |
isMethodOrClassElement(org.codehaus.groovy.ast.AnnotatedNode element)
Whether the element is a field, method, class or constructor.
|
protected boolean |
isValidationRequired(org.codehaus.groovy.ast.AnnotatedNode member)
Return whether the given member requires validation.
|
protected Map<? extends org.codehaus.groovy.ast.AnnotatedNode,?> |
readAnnotationDefaultValues(org.codehaus.groovy.ast.AnnotationNode annotationMirror)
Read the raw default annotation values from the given annotation.
|
protected Map<? extends org.codehaus.groovy.ast.AnnotatedNode,?> |
readAnnotationDefaultValues(String annotationName,
org.codehaus.groovy.ast.AnnotatedNode annotationType)
Read the raw default annotation values from the given annotation.
|
protected void |
readAnnotationRawValues(org.codehaus.groovy.ast.AnnotatedNode originatingElement,
String annotationName,
org.codehaus.groovy.ast.AnnotatedNode member,
String memberName,
Object annotationValue,
Map<CharSequence,Object> annotationValues)
Read the given member and value, applying conversions if necessary, and place the data in the given map.
|
protected Map<? extends org.codehaus.groovy.ast.AnnotatedNode,?> |
readAnnotationRawValues(org.codehaus.groovy.ast.AnnotationNode annotationMirror)
Read the raw annotation values from the given annotation.
|
protected Object |
readAnnotationValue(org.codehaus.groovy.ast.AnnotatedNode originatingElement,
org.codehaus.groovy.ast.AnnotatedNode member,
String memberName,
Object annotationValue)
Read the given member and value, applying conversions if necessary, and place the data in the given map.
|
addMutatedMetadata, annotate, build, build, buildDeclared, buildDeclared, buildForMethod, buildForParent, buildForParent, buildForParent, buildForParents, buildForParents, buildOverridden, clearCaches, clearMutated, copyToRuntime, getAnnotationMappers, getAnnotationTransformers, getMappedAnnotationNames, getMappedAnnotationPackages, isAnnotationMapped, isMetadataMutated, populateAnnotationData, populateAnnotationData, readNestedAnnotationValue, removeAnnotation, removeAnnotationIf, removeStereotype, validateAnnotationValue
public static final org.codehaus.groovy.ast.ClassNode ANN_OVERRIDE
public static final String VALIDATOR_KEY
public GroovyAnnotationMetadataBuilder(org.codehaus.groovy.control.SourceUnit sourceUnit, org.codehaus.groovy.control.CompilationUnit compilationUnit)
protected boolean isValidationRequired(org.codehaus.groovy.ast.AnnotatedNode member)
AbstractAnnotationMetadataBuilder
isValidationRequired
in class AbstractAnnotationMetadataBuilder<org.codehaus.groovy.ast.AnnotatedNode,org.codehaus.groovy.ast.AnnotationNode>
member
- The memberprotected boolean isExcludedAnnotation(@NonNull org.codehaus.groovy.ast.AnnotatedNode element, @NonNull String annotationName)
AbstractAnnotationMetadataBuilder
isExcludedAnnotation
in class AbstractAnnotationMetadataBuilder<org.codehaus.groovy.ast.AnnotatedNode,org.codehaus.groovy.ast.AnnotationNode>
element
- The elementannotationName
- The annotation nameprotected org.codehaus.groovy.ast.AnnotatedNode getAnnotationMember(org.codehaus.groovy.ast.AnnotatedNode originatingElement, CharSequence member)
AbstractAnnotationMetadataBuilder
getAnnotationMember
in class AbstractAnnotationMetadataBuilder<org.codehaus.groovy.ast.AnnotatedNode,org.codehaus.groovy.ast.AnnotationNode>
originatingElement
- The originatig elementmember
- The memberprotected RetentionPolicy getRetentionPolicy(@NonNull org.codehaus.groovy.ast.AnnotatedNode annotation)
AbstractAnnotationMetadataBuilder
getRetentionPolicy
in class AbstractAnnotationMetadataBuilder<org.codehaus.groovy.ast.AnnotatedNode,org.codehaus.groovy.ast.AnnotationNode>
annotation
- The annotationprotected AnnotatedElementValidator getElementValidator()
AbstractAnnotationMetadataBuilder
getElementValidator
in class AbstractAnnotationMetadataBuilder<org.codehaus.groovy.ast.AnnotatedNode,org.codehaus.groovy.ast.AnnotationNode>
protected void addError(@NonNull org.codehaus.groovy.ast.AnnotatedNode originatingElement, @NonNull String error)
AbstractAnnotationMetadataBuilder
addError
in class AbstractAnnotationMetadataBuilder<org.codehaus.groovy.ast.AnnotatedNode,org.codehaus.groovy.ast.AnnotationNode>
originatingElement
- The originating elementerror
- The errorprotected void addWarning(@NonNull org.codehaus.groovy.ast.AnnotatedNode originatingElement, @NonNull String warning)
AbstractAnnotationMetadataBuilder
addWarning
in class AbstractAnnotationMetadataBuilder<org.codehaus.groovy.ast.AnnotatedNode,org.codehaus.groovy.ast.AnnotationNode>
originatingElement
- The originating elementwarning
- The warningprotected boolean isMethodOrClassElement(org.codehaus.groovy.ast.AnnotatedNode element)
AbstractAnnotationMetadataBuilder
isMethodOrClassElement
in class AbstractAnnotationMetadataBuilder<org.codehaus.groovy.ast.AnnotatedNode,org.codehaus.groovy.ast.AnnotationNode>
element
- The elementprotected String getDeclaringType(@NonNull org.codehaus.groovy.ast.AnnotatedNode element)
AbstractAnnotationMetadataBuilder
getDeclaringType
in class AbstractAnnotationMetadataBuilder<org.codehaus.groovy.ast.AnnotatedNode,org.codehaus.groovy.ast.AnnotationNode>
element
- The elementprotected boolean hasAnnotation(org.codehaus.groovy.ast.AnnotatedNode element, Class<? extends Annotation> annotation)
AbstractAnnotationMetadataBuilder
hasAnnotation
in class AbstractAnnotationMetadataBuilder<org.codehaus.groovy.ast.AnnotatedNode,org.codehaus.groovy.ast.AnnotationNode>
element
- The elementannotation
- The annotation typeprotected boolean hasAnnotation(org.codehaus.groovy.ast.AnnotatedNode element, String annotation)
AbstractAnnotationMetadataBuilder
hasAnnotation
in class AbstractAnnotationMetadataBuilder<org.codehaus.groovy.ast.AnnotatedNode,org.codehaus.groovy.ast.AnnotationNode>
element
- The elementannotation
- The annotation type nameprotected boolean hasAnnotations(org.codehaus.groovy.ast.AnnotatedNode element)
AbstractAnnotationMetadataBuilder
hasAnnotations
in class AbstractAnnotationMetadataBuilder<org.codehaus.groovy.ast.AnnotatedNode,org.codehaus.groovy.ast.AnnotationNode>
element
- The elementprotected VisitorContext createVisitorContext()
AbstractAnnotationMetadataBuilder
createVisitorContext
in class AbstractAnnotationMetadataBuilder<org.codehaus.groovy.ast.AnnotatedNode,org.codehaus.groovy.ast.AnnotationNode>
protected org.codehaus.groovy.ast.AnnotatedNode getTypeForAnnotation(org.codehaus.groovy.ast.AnnotationNode annotationMirror)
AbstractAnnotationMetadataBuilder
getTypeForAnnotation
in class AbstractAnnotationMetadataBuilder<org.codehaus.groovy.ast.AnnotatedNode,org.codehaus.groovy.ast.AnnotationNode>
annotationMirror
- The annotationprotected String getRepeatableName(org.codehaus.groovy.ast.AnnotationNode annotationMirror)
AbstractAnnotationMetadataBuilder
getRepeatableName
in class AbstractAnnotationMetadataBuilder<org.codehaus.groovy.ast.AnnotatedNode,org.codehaus.groovy.ast.AnnotationNode>
annotationMirror
- The annotation mirrorprotected String getRepeatableNameForType(org.codehaus.groovy.ast.AnnotatedNode annotationType)
AbstractAnnotationMetadataBuilder
getRepeatableNameForType
in class AbstractAnnotationMetadataBuilder<org.codehaus.groovy.ast.AnnotatedNode,org.codehaus.groovy.ast.AnnotationNode>
annotationType
- The annotation mirrorprotected Optional<org.codehaus.groovy.ast.AnnotatedNode> getAnnotationMirror(String annotationName)
AbstractAnnotationMetadataBuilder
getAnnotationMirror
in class AbstractAnnotationMetadataBuilder<org.codehaus.groovy.ast.AnnotatedNode,org.codehaus.groovy.ast.AnnotationNode>
annotationName
- The annotation nameprotected String getAnnotationTypeName(org.codehaus.groovy.ast.AnnotationNode annotationMirror)
AbstractAnnotationMetadataBuilder
getAnnotationTypeName
in class AbstractAnnotationMetadataBuilder<org.codehaus.groovy.ast.AnnotatedNode,org.codehaus.groovy.ast.AnnotationNode>
annotationMirror
- The annotationprotected String getElementName(org.codehaus.groovy.ast.AnnotatedNode element)
AbstractAnnotationMetadataBuilder
getElementName
in class AbstractAnnotationMetadataBuilder<org.codehaus.groovy.ast.AnnotatedNode,org.codehaus.groovy.ast.AnnotationNode>
element
- The elementprotected List<? extends org.codehaus.groovy.ast.AnnotationNode> getAnnotationsForType(org.codehaus.groovy.ast.AnnotatedNode element)
AbstractAnnotationMetadataBuilder
@Parent(value = {@Child, @Child})
should result in the two
child annotations being returned from this method instead of the
parent annotation.getAnnotationsForType
in class AbstractAnnotationMetadataBuilder<org.codehaus.groovy.ast.AnnotatedNode,org.codehaus.groovy.ast.AnnotationNode>
element
- The type elementprotected List<org.codehaus.groovy.ast.AnnotatedNode> buildHierarchy(org.codehaus.groovy.ast.AnnotatedNode element, boolean inheritTypeAnnotations, boolean declaredOnly)
AbstractAnnotationMetadataBuilder
buildHierarchy
in class AbstractAnnotationMetadataBuilder<org.codehaus.groovy.ast.AnnotatedNode,org.codehaus.groovy.ast.AnnotationNode>
element
- The elementinheritTypeAnnotations
- Whether to inherit type annotationsdeclaredOnly
- Whether to only include declared annotationsprotected void readAnnotationRawValues(org.codehaus.groovy.ast.AnnotatedNode originatingElement, String annotationName, org.codehaus.groovy.ast.AnnotatedNode member, String memberName, Object annotationValue, Map<CharSequence,Object> annotationValues)
AbstractAnnotationMetadataBuilder
readAnnotationRawValues
in class AbstractAnnotationMetadataBuilder<org.codehaus.groovy.ast.AnnotatedNode,org.codehaus.groovy.ast.AnnotationNode>
originatingElement
- The originating elementannotationName
- The annotation namemember
- The member being read frommemberName
- The memberannotationValue
- The valueannotationValues
- The values to populateprotected Map<? extends org.codehaus.groovy.ast.AnnotatedNode,?> readAnnotationDefaultValues(String annotationName, org.codehaus.groovy.ast.AnnotatedNode annotationType)
AbstractAnnotationMetadataBuilder
readAnnotationDefaultValues
in class AbstractAnnotationMetadataBuilder<org.codehaus.groovy.ast.AnnotatedNode,org.codehaus.groovy.ast.AnnotationNode>
annotationName
- annotation nameannotationType
- the typeprotected boolean isInheritedAnnotation(@NonNull org.codehaus.groovy.ast.AnnotationNode annotationMirror)
AbstractAnnotationMetadataBuilder
isInheritedAnnotation
in class AbstractAnnotationMetadataBuilder<org.codehaus.groovy.ast.AnnotatedNode,org.codehaus.groovy.ast.AnnotationNode>
annotationMirror
- The mirrorprotected boolean isInheritedAnnotationType(@NonNull org.codehaus.groovy.ast.AnnotatedNode annotationType)
AbstractAnnotationMetadataBuilder
isInheritedAnnotationType
in class AbstractAnnotationMetadataBuilder<org.codehaus.groovy.ast.AnnotatedNode,org.codehaus.groovy.ast.AnnotationNode>
annotationType
- The mirrorprotected Map<String,? extends org.codehaus.groovy.ast.AnnotatedNode> getAnnotationMembers(String annotationType)
AbstractAnnotationMetadataBuilder
getAnnotationMembers
in class AbstractAnnotationMetadataBuilder<org.codehaus.groovy.ast.AnnotatedNode,org.codehaus.groovy.ast.AnnotationNode>
annotationType
- The annotation typeprotected boolean hasSimpleAnnotation(org.codehaus.groovy.ast.AnnotatedNode element, String simpleName)
AbstractAnnotationMetadataBuilder
hasSimpleAnnotation
in class AbstractAnnotationMetadataBuilder<org.codehaus.groovy.ast.AnnotatedNode,org.codehaus.groovy.ast.AnnotationNode>
element
- The elementsimpleName
- The simple name, ie Class.getSimpleName()
protected Map<? extends org.codehaus.groovy.ast.AnnotatedNode,?> readAnnotationDefaultValues(org.codehaus.groovy.ast.AnnotationNode annotationMirror)
AbstractAnnotationMetadataBuilder
readAnnotationDefaultValues
in class AbstractAnnotationMetadataBuilder<org.codehaus.groovy.ast.AnnotatedNode,org.codehaus.groovy.ast.AnnotationNode>
annotationMirror
- The annotationprotected Object readAnnotationValue(org.codehaus.groovy.ast.AnnotatedNode originatingElement, org.codehaus.groovy.ast.AnnotatedNode member, String memberName, Object annotationValue)
AbstractAnnotationMetadataBuilder
readAnnotationValue
in class AbstractAnnotationMetadataBuilder<org.codehaus.groovy.ast.AnnotatedNode,org.codehaus.groovy.ast.AnnotationNode>
originatingElement
- The originating elementmember
- The membermemberName
- The member nameannotationValue
- The valueprotected Map<? extends org.codehaus.groovy.ast.AnnotatedNode,?> readAnnotationRawValues(org.codehaus.groovy.ast.AnnotationNode annotationMirror)
AbstractAnnotationMetadataBuilder
readAnnotationRawValues
in class AbstractAnnotationMetadataBuilder<org.codehaus.groovy.ast.AnnotatedNode,org.codehaus.groovy.ast.AnnotationNode>
annotationMirror
- The annotationprotected OptionalValues<?> getAnnotationValues(org.codehaus.groovy.ast.AnnotatedNode originatingElement, org.codehaus.groovy.ast.AnnotatedNode member, Class<?> annotationType)
AbstractAnnotationMetadataBuilder
getAnnotationValues
in class AbstractAnnotationMetadataBuilder<org.codehaus.groovy.ast.AnnotatedNode,org.codehaus.groovy.ast.AnnotationNode>
originatingElement
- The originating elementmember
- The memberannotationType
- The typeprotected String getAnnotationMemberName(org.codehaus.groovy.ast.AnnotatedNode member)
AbstractAnnotationMetadataBuilder
getAnnotationMemberName
in class AbstractAnnotationMetadataBuilder<org.codehaus.groovy.ast.AnnotatedNode,org.codehaus.groovy.ast.AnnotationNode>
member
- The member