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 List<Element> |
buildHierarchy(Element element,
boolean inheritTypeAnnotations,
boolean declaredOnly)
Build the type hierarchy for the given element.
|
protected VisitorContext |
createVisitorContext()
Creates the visitor context for this implementation.
|
protected String |
getAnnotationMemberName(Element member)
Read the name of an annotation member.
|
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 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 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.
|
static boolean |
hasAnnotation(ExecutableElement method,
Class<? extends Annotation> ann)
Checks if a method has an annotation.
|
protected boolean |
isMethodOrClassElement(Element element)
Whether the element is a field, method, class or constructor.
|
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,
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, buildForMethod, buildForParent, buildForParent, buildForParent, clearMutated, isAnnotationMapped, isMetadataMutated, populateAnnotationData, readNestedAnnotationValue, 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 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>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)
AbstractAnnotationMetadataBuildergetAnnotationsForType in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>element - The type elementprotected 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 annotationprotected 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 Object readAnnotationValue(Element originatingElement, String memberName, Object annotationValue)
AbstractAnnotationMetadataBuilderreadAnnotationValue in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>originatingElement - The originating elementmemberName - The memberannotationValue - 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 annotationpublic boolean hasAnnotation(Element element, Class<? extends Annotation> ann)
hasAnnotation in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>element - The methodann - The annotation to look forpublic static boolean hasAnnotation(ExecutableElement method, Class<? extends Annotation> ann)
method - The methodann - The annotation to look for