public class JavaAnnotationMetadataBuilder extends AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>
AnnotationMetadata for builder for Java to be used at compile time.| Constructor and Description |
|---|
JavaAnnotationMetadataBuilder(Elements elements,
Messager messager,
AnnotationUtils annotationUtils,
ModelUtils modelUtils)
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addError(Element originatingElement,
String error)
Adds an error.
|
protected void |
addWarning(Element originatingElement,
String warning)
Adds an warning.
|
protected List<Element> |
buildHierarchy(Element element,
boolean inheritTypeAnnotations,
boolean declaredOnly)
Build the type hierarchy for the given element.
|
static void |
clearCaches()
Clears any caches from the last compilation round.
|
protected VisitorContext |
createVisitorContext()
Creates the visitor context for this implementation.
|
protected Element |
getAnnotationMember(Element originatingElement,
CharSequence member)
Get the annotation member.
|
protected String |
getAnnotationMemberName(Element member)
Read the name of an annotation member.
|
protected Map<String,Element> |
getAnnotationMembers(String annotationType)
Gets the annotation members for the given type.
|
protected Optional<Element> |
getAnnotationMirror(String annotationName)
Return a mirror for the given annotation.
|
protected List<? extends AnnotationMirror> |
getAnnotationsForType(Element element)
Obtain the annotations for the given type.
|
protected String |
getAnnotationTypeName(AnnotationMirror annotationMirror)
Get the given type of the annotation.
|
protected OptionalValues<?> |
getAnnotationValues(Element originatingElement,
Element member,
Class<?> annotationType)
Resolve the annotations values from the given member for the given type.
|
protected String |
getDeclaringType(Element element)
Obtains the declaring type for an element.
|
protected String |
getElementName(Element element)
Get the name for the given element.
|
protected AnnotatedElementValidator |
getElementValidator()
Obtains the element validator.
|
protected String |
getRepeatableName(AnnotationMirror annotationMirror)
Obtain the name of the repeatable annotation if the annotation is is one.
|
protected String |
getRepeatableNameForType(Element annotationType)
Obtain the name of the repeatable annotation if the annotation is is one.
|
protected RetentionPolicy |
getRetentionPolicy(Element annotation)
Gets the retention policy for the given annotation.
|
protected Element |
getTypeForAnnotation(AnnotationMirror annotationMirror)
Get the type of the given annotation.
|
boolean |
hasAnnotation(Element element,
Class<? extends Annotation> ann)
Checks if a method has an annotation.
|
boolean |
hasAnnotation(Element element,
String ann)
Checks if a method has an annotation.
|
static boolean |
hasAnnotation(ExecutableElement method,
Class<? extends Annotation> ann)
Checks if a method has an annotation.
|
protected boolean |
hasAnnotations(Element element)
Checks whether any annotations are present on the given element.
|
protected boolean |
hasSimpleAnnotation(Element element,
String simpleName)
Returns true if a simple meta annotation is present for the given element and annotation type.
|
protected boolean |
isExcludedAnnotation(Element element,
String annotationName)
Is the given annotation excluded for the specified element.
|
protected boolean |
isInheritedAnnotation(AnnotationMirror annotationMirror)
Test whether the annotation mirror is inherited.
|
protected boolean |
isInheritedAnnotationType(Element annotationType)
Test whether the annotation mirror is inherited.
|
protected boolean |
isMethodOrClassElement(Element element)
Whether the element is a field, method, class or constructor.
|
protected boolean |
isValidationRequired(Element member)
Return whether the given member requires validation.
|
protected Map<? extends Element,?> |
readAnnotationDefaultValues(AnnotationMirror annotationMirror)
Read the raw default annotation values from the given annotation.
|
protected Map<? extends Element,?> |
readAnnotationDefaultValues(String annotationTypeName,
Element element)
Read the raw default annotation values from the given annotation.
|
protected Map<? extends Element,?> |
readAnnotationRawValues(AnnotationMirror annotationMirror)
Read the raw annotation values from the given annotation.
|
protected void |
readAnnotationRawValues(Element originatingElement,
String annotationName,
Element 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 Object |
readAnnotationValue(Element originatingElement,
Element 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, clearMutated, copyToRuntime, getAnnotationMappers, getAnnotationTransformers, getMappedAnnotationNames, getMappedAnnotationPackages, isAnnotationMapped, isMetadataMutated, populateAnnotationData, populateAnnotationData, readNestedAnnotationValue, removeAnnotation, removeAnnotationIf, removeStereotype, validateAnnotationValuepublic JavaAnnotationMetadataBuilder(Elements elements, Messager messager, AnnotationUtils annotationUtils, ModelUtils modelUtils)
elements - The elementUtilsmessager - The messagerannotationUtils - The annotation utilsmodelUtils - The model utils@Nullable protected AnnotatedElementValidator getElementValidator()
AbstractAnnotationMetadataBuildergetElementValidator in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>protected void addError(@NonNull Element originatingElement, @NonNull String error)
AbstractAnnotationMetadataBuilderaddError in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>originatingElement - The originating elementerror - The errorprotected void addWarning(@NonNull Element originatingElement, @NonNull String warning)
AbstractAnnotationMetadataBuilderaddWarning in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>originatingElement - The originating elementwarning - The warningprotected String getAnnotationMemberName(Element member)
AbstractAnnotationMetadataBuildergetAnnotationMemberName in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>member - The member@Nullable protected String getRepeatableName(AnnotationMirror annotationMirror)
AbstractAnnotationMetadataBuildergetRepeatableName in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>annotationMirror - The annotation mirror@Nullable protected String getRepeatableNameForType(Element annotationType)
AbstractAnnotationMetadataBuildergetRepeatableNameForType in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>annotationType - The annotation mirrorprotected Optional<Element> getAnnotationMirror(String annotationName)
AbstractAnnotationMetadataBuildergetAnnotationMirror in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>annotationName - The annotation nameprotected VisitorContext createVisitorContext()
AbstractAnnotationMetadataBuildercreateVisitorContext in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>@NonNull protected RetentionPolicy getRetentionPolicy(@NonNull Element annotation)
AbstractAnnotationMetadataBuildergetRetentionPolicy in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>annotation - The annotationprotected boolean isInheritedAnnotation(@NonNull AnnotationMirror annotationMirror)
AbstractAnnotationMetadataBuilderisInheritedAnnotation in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>annotationMirror - The mirrorprotected boolean isInheritedAnnotationType(@NonNull Element annotationType)
AbstractAnnotationMetadataBuilderisInheritedAnnotationType in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>annotationType - The mirrorprotected Map<String,Element> getAnnotationMembers(String annotationType)
AbstractAnnotationMetadataBuildergetAnnotationMembers in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>annotationType - The annotation typeprotected boolean hasSimpleAnnotation(Element element, String simpleName)
AbstractAnnotationMetadataBuilderhasSimpleAnnotation in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>element - The elementsimpleName - The simple name, ie Class.getSimpleName()protected boolean isMethodOrClassElement(Element element)
AbstractAnnotationMetadataBuilderisMethodOrClassElement in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>element - The element@NonNull protected String getDeclaringType(@NonNull Element element)
AbstractAnnotationMetadataBuildergetDeclaringType in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>element - The elementprotected Element getTypeForAnnotation(AnnotationMirror annotationMirror)
AbstractAnnotationMetadataBuildergetTypeForAnnotation in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>annotationMirror - The annotationprotected List<? extends AnnotationMirror> getAnnotationsForType(Element 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<Element,AnnotationMirror>element - The type elementprotected boolean isExcludedAnnotation(@NonNull Element element, @NonNull String annotationName)
AbstractAnnotationMetadataBuilderisExcludedAnnotation in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>element - The elementannotationName - The annotation nameprotected List<Element> buildHierarchy(Element element, boolean inheritTypeAnnotations, boolean declaredOnly)
AbstractAnnotationMetadataBuilderbuildHierarchy in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>element - The elementinheritTypeAnnotations - Whether to inherit type annotationsdeclaredOnly - Whether to only include declared annotationsprotected Map<? extends Element,?> readAnnotationRawValues(AnnotationMirror annotationMirror)
AbstractAnnotationMetadataBuilderreadAnnotationRawValues in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>annotationMirror - The annotation@Nullable protected Element getAnnotationMember(Element originatingElement, CharSequence member)
AbstractAnnotationMetadataBuildergetAnnotationMember in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>originatingElement - The originatig elementmember - The memberprotected OptionalValues<?> getAnnotationValues(Element originatingElement, Element member, Class<?> annotationType)
AbstractAnnotationMetadataBuildergetAnnotationValues in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>originatingElement - The originating elementmember - The memberannotationType - The typeprotected void readAnnotationRawValues(Element originatingElement, String annotationName, Element member, String memberName, Object annotationValue, Map<CharSequence,Object> annotationValues)
AbstractAnnotationMetadataBuilderreadAnnotationRawValues in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>originatingElement - The originating elementannotationName - The annotation namemember - The member being read frommemberName - The memberannotationValue - The valueannotationValues - The values to populateprotected boolean isValidationRequired(Element member)
AbstractAnnotationMetadataBuilderisValidationRequired in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>member - The memberprotected Object readAnnotationValue(Element originatingElement, Element member, String memberName, Object annotationValue)
AbstractAnnotationMetadataBuilderreadAnnotationValue in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>originatingElement - The originating elementmember - The membermemberName - The member nameannotationValue - The valueprotected Map<? extends Element,?> readAnnotationDefaultValues(AnnotationMirror annotationMirror)
AbstractAnnotationMetadataBuilderreadAnnotationDefaultValues in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>annotationMirror - The annotationprotected Map<? extends Element,?> readAnnotationDefaultValues(String annotationTypeName, Element element)
AbstractAnnotationMetadataBuilderreadAnnotationDefaultValues in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>annotationTypeName - annotation nameelement - the typeprotected String getAnnotationTypeName(AnnotationMirror annotationMirror)
AbstractAnnotationMetadataBuildergetAnnotationTypeName in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>annotationMirror - The annotationprotected String getElementName(Element element)
AbstractAnnotationMetadataBuildergetElementName in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>element - The elementpublic boolean hasAnnotation(Element element, Class<? extends Annotation> ann)
hasAnnotation in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>element - The methodann - The annotation to look forpublic boolean hasAnnotation(Element element, String ann)
hasAnnotation in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>element - The methodann - The annotation to look forprotected boolean hasAnnotations(Element element)
AbstractAnnotationMetadataBuilderhasAnnotations in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>element - The elementpublic static void clearCaches()
public static boolean hasAnnotation(ExecutableElement method, Class<? extends Annotation> ann)
method - The methodann - The annotation to look for