T - The element typeA - The annotation typepublic abstract class AbstractAnnotationMetadataBuilder<T,A>
extends java.lang.Object
AnnotationMetadata.| Modifier | Constructor and Description | 
|---|---|
protected  | 
AbstractAnnotationMetadataBuilder()
Default constructor. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
protected abstract void | 
addError(T originatingElement,
        java.lang.String error)
Adds an error. 
 | 
static void | 
addMutatedMetadata(java.lang.String declaringType,
                  java.lang.Object element,
                  AnnotationMetadata metadata)
Used to store metadata mutations at compilation time. 
 | 
protected abstract void | 
addWarning(T originatingElement,
          java.lang.String warning)
Adds an warning. 
 | 
<A2 extends java.lang.annotation.Annotation> | 
annotate(AnnotationMetadata annotationMetadata,
        AnnotationValue<A2> annotationValue)
Annotate an existing annotation metadata object. 
 | 
AnnotationMetadata | 
build(java.lang.String declaringType,
     T element)
Build the meta data for the given element. 
 | 
AnnotationMetadata | 
build(T element)
Build the meta data for the given element. 
 | 
AnnotationMetadata | 
buildDeclared(T element)
Build only metadata for declared annotations. 
 | 
AnnotationMetadata | 
buildDeclared(T element,
             java.util.List<? extends A> annotations,
             boolean includeTypeAnnotations)
Build only metadata for declared annotations. 
 | 
AnnotationMetadata | 
buildForMethod(T element)
Build the meta data for the given method element excluding any class metadata. 
 | 
AnnotationMetadata | 
buildForParent(java.lang.String declaringType,
              T parent,
              T element)
Build the meta data for the given parent and method element excluding any class metadata. 
 | 
AnnotationMetadata | 
buildForParent(T parent,
              T element)
Get the annotation metadata for the given element and the given parent. 
 | 
AnnotationMetadata | 
buildForParent(T parent,
              T element,
              boolean inheritTypeAnnotations)
Build the meta data for the given method element excluding any class metadata. 
 | 
protected abstract java.util.List<T> | 
buildHierarchy(T element,
              boolean inheritTypeAnnotations,
              boolean declaredOnly)
Build the type hierarchy for the given element. 
 | 
AnnotationMetadata | 
buildOverridden(T element)
Build metadata for the given element, including any metadata that is inherited via method or type overrides. 
 | 
static void | 
clearMutated()
Used to clear mutated metadata at the end of a compilation cycle. 
 | 
protected abstract VisitorContext | 
createVisitorContext()
Creates the visitor context for this implementation. 
 | 
protected java.util.List<AnnotationMapper<? extends java.lang.annotation.Annotation>> | 
getAnnotationMappers(java.lang.String annotationName)
Obtain the annotation mappers for the given annotation name. 
 | 
protected abstract T | 
getAnnotationMember(T originatingElement,
                   java.lang.CharSequence member)
Get the annotation member. 
 | 
protected abstract java.lang.String | 
getAnnotationMemberName(T member)
Read the name of an annotation member. 
 | 
protected abstract java.util.Optional<T> | 
getAnnotationMirror(java.lang.String annotationName)
Return a mirror for the given annotation. 
 | 
protected abstract java.util.List<? extends A> | 
getAnnotationsForType(T element)
Obtain the annotations for the given type. 
 | 
protected java.util.List<AnnotationTransformer<java.lang.annotation.Annotation>> | 
getAnnotationTransformers(java.lang.String annotationName)
Obtain the transformers mappers for the given annotation name. 
 | 
protected abstract java.lang.String | 
getAnnotationTypeName(A annotationMirror)
Get the given type of the annotation. 
 | 
protected abstract OptionalValues<?> | 
getAnnotationValues(T originatingElement,
                   T member,
                   java.lang.Class<?> annotationType)
Resolve the annotations values from the given member for the given type. 
 | 
protected abstract java.lang.String | 
getDeclaringType(T element)
Obtains the declaring type for an element. 
 | 
protected abstract java.lang.String | 
getElementName(T element)
Get the name for the given element. 
 | 
protected AnnotatedElementValidator | 
getElementValidator()
Obtains the element validator. 
 | 
static java.util.Set<java.lang.String> | 
getMappedAnnotationNames()  | 
static java.util.Set<java.lang.String> | 
getMappedAnnotationPackages()  | 
protected abstract java.lang.String | 
getRepeatableName(A annotationMirror)
Obtain the name of the repeatable annotation if the annotation is is one. 
 | 
protected abstract java.lang.String | 
getRepeatableNameForType(T annotationType)
Obtain the name of the repeatable annotation if the annotation is is one. 
 | 
protected abstract java.lang.annotation.RetentionPolicy | 
getRetentionPolicy(T annotation)
Gets the retention policy for the given annotation. 
 | 
protected abstract T | 
getTypeForAnnotation(A annotationMirror)
Get the type of the given annotation. 
 | 
protected abstract boolean | 
hasAnnotation(T element,
             java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
Checks whether an annotation is present. 
 | 
protected abstract boolean | 
hasAnnotation(T element,
             java.lang.String annotation)
Checks whether an annotation is present. 
 | 
protected abstract boolean | 
hasAnnotations(T element)
Checks whether any annotations are present on the given element. 
 | 
static boolean | 
isAnnotationMapped(java.lang.String annotationName)
Returns whether the given annotation is a mapped annotation. 
 | 
protected boolean | 
isExcludedAnnotation(T element,
                    java.lang.String annotationName)
Is the given annotation excluded for the specified element. 
 | 
protected abstract boolean | 
isInheritedAnnotation(A annotationMirror)
Test whether the annotation mirror is inherited. 
 | 
protected abstract boolean | 
isInheritedAnnotationType(T annotationType)
Test whether the annotation mirror is inherited. 
 | 
static boolean | 
isMetadataMutated(java.lang.String declaringType,
                 java.lang.Object element)
Used to store metadata mutations at compilation time. 
 | 
protected abstract boolean | 
isMethodOrClassElement(T element)
Whether the element is a field, method, class or constructor. 
 | 
protected abstract boolean | 
isValidationRequired(T member)
Return whether the given member requires validation. 
 | 
protected java.util.Map<java.lang.CharSequence,java.lang.Object> | 
populateAnnotationData(T originatingElement,
                      T parent,
                      A annotationMirror,
                      DefaultAnnotationMetadata metadata,
                      boolean isDeclared,
                      java.lang.annotation.RetentionPolicy retentionPolicy,
                      boolean allowAliases)
Populate the annotation data for the given annotation. 
 | 
protected abstract java.util.Map<? extends T,?> | 
readAnnotationDefaultValues(A annotationMirror)
Read the raw default annotation values from the given annotation. 
 | 
protected abstract java.util.Map<? extends T,?> | 
readAnnotationDefaultValues(java.lang.String annotationName,
                           T annotationType)
Read the raw default annotation values from the given annotation. 
 | 
protected abstract java.util.Map<? extends T,?> | 
readAnnotationRawValues(A annotationMirror)
Read the raw annotation values from the given annotation. 
 | 
protected abstract void | 
readAnnotationRawValues(T originatingElement,
                       java.lang.String annotationName,
                       T member,
                       java.lang.String memberName,
                       java.lang.Object annotationValue,
                       java.util.Map<java.lang.CharSequence,java.lang.Object> annotationValues)
Read the given member and value, applying conversions if necessary, and place the data in the given map. 
 | 
protected abstract java.lang.Object | 
readAnnotationValue(T originatingElement,
                   T member,
                   java.lang.String memberName,
                   java.lang.Object annotationValue)
Read the given member and value, applying conversions if necessary, and place the data in the given map. 
 | 
protected AnnotationValue | 
readNestedAnnotationValue(T originatingElement,
                         A annotationMirror)  | 
AnnotationMetadata | 
removeAnnotation(AnnotationMetadata annotationMetadata,
                java.lang.String annotationType)
Removes an annotation from the given annotation metadata. 
 | 
<T1 extends java.lang.annotation.Annotation> | 
removeAnnotationIf(AnnotationMetadata annotationMetadata,
                  java.util.function.Predicate<AnnotationValue<T1>> predicate)
Removes an annotation from the metadata for the given predicate. 
 | 
AnnotationMetadata | 
removeStereotype(AnnotationMetadata annotationMetadata,
                java.lang.String annotationType)
Removes an annotation from the given annotation metadata. 
 | 
protected void | 
validateAnnotationValue(T originatingElement,
                       java.lang.String annotationName,
                       T member,
                       java.lang.String memberName,
                       java.lang.Object resolvedValue)
Validates an annotation value. 
 | 
protected AbstractAnnotationMetadataBuilder()
public AnnotationMetadata buildDeclared(T element)
element - The elementAnnotationMetadatapublic AnnotationMetadata buildDeclared(T element, java.util.List<? extends A> annotations, boolean includeTypeAnnotations)
element - The elementannotations - The annotationsincludeTypeAnnotations - Whether to include type level annotations in the metadata for the elementAnnotationMetadatapublic AnnotationMetadata buildOverridden(T element)
element - The elementAnnotationMetadatapublic AnnotationMetadata build(T element)
element - The elementAnnotationMetadatapublic AnnotationMetadata build(java.lang.String declaringType, T element)
declaringType - The declaring typeelement - The elementAnnotationMetadataprotected abstract boolean isMethodOrClassElement(T element)
element - The element@NonNull protected abstract java.lang.String getDeclaringType(@NonNull T element)
element - The elementpublic AnnotationMetadata buildForMethod(T element)
element - The elementAnnotationMetadatapublic AnnotationMetadata buildForParent(T parent, T element)
parent - The parent elementelement - The elementAnnotationMetadatapublic AnnotationMetadata buildForParent(java.lang.String declaringType, T parent, T element)
declaringType - The declaring typeparent - The parent elementelement - The elementAnnotationMetadatapublic AnnotationMetadata buildForParent(T parent, T element, boolean inheritTypeAnnotations)
parent - The parent elementelement - The elementinheritTypeAnnotations - Whether to inherit annotations from type as stereotypesAnnotationMetadataprotected abstract T getTypeForAnnotation(A annotationMirror)
annotationMirror - The annotationprotected abstract boolean hasAnnotation(T element, java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
element - The elementannotation - The annotation typeprotected abstract boolean hasAnnotation(T element, java.lang.String annotation)
element - The elementannotation - The annotation type nameprotected abstract boolean hasAnnotations(T element)
element - The elementprotected abstract java.lang.String getAnnotationTypeName(A annotationMirror)
annotationMirror - The annotationprotected abstract java.lang.String getElementName(T element)
element - The elementprotected abstract java.util.List<? extends A> getAnnotationsForType(T element)
@Parent(value = {@Child, @Child}) should result in the two
 child annotations being returned from this method instead of the
 parent annotation.element - The type elementprotected abstract java.util.List<T> buildHierarchy(T element, boolean inheritTypeAnnotations, boolean declaredOnly)
element - The elementinheritTypeAnnotations - Whether to inherit type annotationsdeclaredOnly - Whether to only include declared annotationsprotected abstract void readAnnotationRawValues(T originatingElement, java.lang.String annotationName, T member, java.lang.String memberName, java.lang.Object annotationValue, java.util.Map<java.lang.CharSequence,java.lang.Object> annotationValues)
originatingElement - The originating elementannotationName - The annotation namemember - The member being read frommemberName - The memberannotationValue - The valueannotationValues - The values to populateprotected void validateAnnotationValue(T originatingElement, java.lang.String annotationName, T member, java.lang.String memberName, java.lang.Object resolvedValue)
originatingElement - The originating elementannotationName - The annotation namemember - The membermemberName - The member nameresolvedValue - The resolved valueprotected abstract boolean isValidationRequired(T member)
member - The member@Nullable protected AnnotatedElementValidator getElementValidator()
protected abstract void addError(@NonNull T originatingElement, @NonNull java.lang.String error)
originatingElement - The originating elementerror - The errorprotected abstract void addWarning(@NonNull T originatingElement, @NonNull java.lang.String warning)
originatingElement - The originating elementwarning - The warningprotected abstract java.lang.Object readAnnotationValue(T originatingElement, T member, java.lang.String memberName, java.lang.Object annotationValue)
originatingElement - The originating elementmember - The membermemberName - The member nameannotationValue - The valueprotected abstract java.util.Map<? extends T,?> readAnnotationDefaultValues(A annotationMirror)
annotationMirror - The annotationprotected abstract java.util.Map<? extends T,?> readAnnotationDefaultValues(java.lang.String annotationName, T annotationType)
annotationName - annotation nameannotationType - the typeprotected abstract java.util.Map<? extends T,?> readAnnotationRawValues(A annotationMirror)
annotationMirror - The annotationprotected abstract OptionalValues<?> getAnnotationValues(T originatingElement, T member, java.lang.Class<?> annotationType)
originatingElement - The originating elementmember - The memberannotationType - The typeprotected abstract java.lang.String getAnnotationMemberName(T member)
member - The member@Nullable protected abstract java.lang.String getRepeatableName(A annotationMirror)
annotationMirror - The annotation mirror@Nullable protected abstract java.lang.String getRepeatableNameForType(T annotationType)
annotationType - The annotation mirrorprotected AnnotationValue readNestedAnnotationValue(T originatingElement, A annotationMirror)
originatingElement - The originating elementannotationMirror - The annotationprotected abstract java.util.Optional<T> getAnnotationMirror(java.lang.String annotationName)
annotationName - The annotation nameprotected java.util.Map<java.lang.CharSequence,java.lang.Object> populateAnnotationData(T originatingElement, @Nullable T parent, A annotationMirror, DefaultAnnotationMetadata metadata, boolean isDeclared, java.lang.annotation.RetentionPolicy retentionPolicy, boolean allowAliases)
originatingElement - The element the annotation data originates fromparent - The parent elementannotationMirror - The annotationmetadata - the metadataisDeclared - Is the annotation a declared annotationretentionPolicy - The retention policyallowAliases - Whether aliases are allowed@Nullable protected abstract T getAnnotationMember(T originatingElement, java.lang.CharSequence member)
originatingElement - The originatig elementmember - The member@NonNull protected java.util.List<AnnotationMapper<? extends java.lang.annotation.Annotation>> getAnnotationMappers(@NonNull java.lang.String annotationName)
annotationName - The annotation name@NonNull protected java.util.List<AnnotationTransformer<java.lang.annotation.Annotation>> getAnnotationTransformers(@NonNull java.lang.String annotationName)
annotationName - The annotation nameprotected abstract VisitorContext createVisitorContext()
@NonNull protected abstract java.lang.annotation.RetentionPolicy getRetentionPolicy(@NonNull T annotation)
annotation - The annotationprotected boolean isExcludedAnnotation(@NonNull T element, @NonNull java.lang.String annotationName)
element - The elementannotationName - The annotation nameprotected abstract boolean isInheritedAnnotation(@NonNull A annotationMirror)
annotationMirror - The mirrorprotected abstract boolean isInheritedAnnotationType(@NonNull T annotationType)
annotationType - The mirror@Internal public static void addMutatedMetadata(java.lang.String declaringType, java.lang.Object element, AnnotationMetadata metadata)
declaringType - The declaring typeelement - The elementmetadata - The metadata@Internal public static boolean isMetadataMutated(java.lang.String declaringType, java.lang.Object element)
declaringType - The declaring typeelement - The element@Internal public static void clearMutated()
@Internal public static boolean isAnnotationMapped(@Nullable java.lang.String annotationName)
annotationName - The annotation name@Internal public static java.util.Set<java.lang.String> getMappedAnnotationNames()
@Internal public static java.util.Set<java.lang.String> getMappedAnnotationPackages()
public <A2 extends java.lang.annotation.Annotation> AnnotationMetadata annotate(AnnotationMetadata annotationMetadata, AnnotationValue<A2> annotationValue)
A2 - The annotation typeannotationMetadata - The annotation metadataannotationValue - The annotation valuepublic AnnotationMetadata removeAnnotation(AnnotationMetadata annotationMetadata, java.lang.String annotationType)
annotationMetadata - The annotation metadataannotationType - The annotation typepublic AnnotationMetadata removeStereotype(AnnotationMetadata annotationMetadata, java.lang.String annotationType)
annotationMetadata - The annotation metadataannotationType - The annotation type@NonNull public <T1 extends java.lang.annotation.Annotation> AnnotationMetadata removeAnnotationIf(@NonNull AnnotationMetadata annotationMetadata, @NonNull java.util.function.Predicate<AnnotationValue<T1>> predicate)
T1 - The annotation typeannotationMetadata - The annotation metadatapredicate - The predicate