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,
Types types,
ModelUtils modelUtils,
Filer filer)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
protected List<Element> |
buildHierarchy(Element element,
boolean inheritTypeAnnotations)
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 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 |
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(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(String memberName,
Object annotationValue)
Read the given member and value, applying conversions if necessary, and place the data in the given map.
|
addMutatedMetadata, build, build, buildForMethod, buildForParent, buildForParent, buildForParent, clearMutated, isAnnotationMapped, isMetadataMutated, populateAnnotationData, readNestedAnnotationValue
public JavaAnnotationMetadataBuilder(Elements elements, Messager messager, AnnotationUtils annotationUtils, Types types, ModelUtils modelUtils, Filer filer)
elements
- The elementUtilsmessager
- The messagerannotationUtils
- The annotation utilstypes
- The typesmodelUtils
- The model utilsfiler
- The filerprotected String getAnnotationMemberName(Element member)
AbstractAnnotationMetadataBuilder
getAnnotationMemberName
in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>
member
- The member@Nullable protected String getRepeatableName(AnnotationMirror annotationMirror)
AbstractAnnotationMetadataBuilder
getRepeatableName
in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>
annotationMirror
- The annotation mirror@Nullable protected String getRepeatableNameForType(Element annotationType)
AbstractAnnotationMetadataBuilder
getRepeatableNameForType
in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>
annotationType
- The annotation mirrorprotected Optional<Element> getAnnotationMirror(String annotationName)
AbstractAnnotationMetadataBuilder
getAnnotationMirror
in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>
annotationName
- The annotation nameprotected VisitorContext createVisitorContext()
AbstractAnnotationMetadataBuilder
createVisitorContext
in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>
protected boolean isMethodOrClassElement(Element element)
AbstractAnnotationMetadataBuilder
isMethodOrClassElement
in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>
element
- The element@Nonnull protected String getDeclaringType(@Nonnull Element element)
AbstractAnnotationMetadataBuilder
getDeclaringType
in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>
element
- The elementprotected Element getTypeForAnnotation(AnnotationMirror annotationMirror)
AbstractAnnotationMetadataBuilder
getTypeForAnnotation
in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>
annotationMirror
- The annotationprotected List<? extends AnnotationMirror> getAnnotationsForType(Element element)
AbstractAnnotationMetadataBuilder
getAnnotationsForType
in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>
element
- The type elementprotected List<Element> buildHierarchy(Element element, boolean inheritTypeAnnotations)
AbstractAnnotationMetadataBuilder
buildHierarchy
in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>
element
- The elementinheritTypeAnnotations
- Whether to inherit type annotationsprotected Map<? extends Element,?> readAnnotationRawValues(AnnotationMirror annotationMirror)
AbstractAnnotationMetadataBuilder
readAnnotationRawValues
in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>
annotationMirror
- The annotationprotected OptionalValues<?> getAnnotationValues(Element member, Class<?> annotationType)
AbstractAnnotationMetadataBuilder
getAnnotationValues
in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>
member
- The memberannotationType
- The typeprotected void readAnnotationRawValues(String memberName, Object annotationValue, Map<CharSequence,Object> annotationValues)
AbstractAnnotationMetadataBuilder
readAnnotationRawValues
in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>
memberName
- The memberannotationValue
- The valueannotationValues
- The values to populateprotected Object readAnnotationValue(String memberName, Object annotationValue)
AbstractAnnotationMetadataBuilder
readAnnotationValue
in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>
memberName
- The memberannotationValue
- The valueprotected Map<? extends Element,?> readAnnotationDefaultValues(AnnotationMirror annotationMirror)
AbstractAnnotationMetadataBuilder
readAnnotationDefaultValues
in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>
annotationMirror
- The annotationprotected Map<? extends Element,?> readAnnotationDefaultValues(String annotationTypeName, Element element)
AbstractAnnotationMetadataBuilder
readAnnotationDefaultValues
in class AbstractAnnotationMetadataBuilder<Element,AnnotationMirror>
annotationTypeName
- annotation nameelement
- the typeprotected String getAnnotationTypeName(AnnotationMirror annotationMirror)
AbstractAnnotationMetadataBuilder
getAnnotationTypeName
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