@Internal public abstract class AbstractEnvironmentAnnotationMetadata extends Object implements AnnotationMetadata
AnnotationMetadata that is environment specific.| Modifier and Type | Field and Description |
|---|---|
protected Map<String,Annotation> |
annotationMap |
protected Map<String,Annotation> |
declaredAnnotationMap |
CLASS_NAME_SUFFIX, EMPTY_METADATA, VALUE_MEMBEREMPTY| Modifier | Constructor and Description |
|---|---|
protected |
AbstractEnvironmentAnnotationMetadata(DefaultAnnotationMetadata targetMetadata)
Construct a new environment aware annotation metadata.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addAnnotationValuesFromData(List results,
Map<CharSequence,Object> values)
Adds any annotation values found in the values map to the results.
|
protected void |
addValuesToResults(List<AnnotationValue> results,
AnnotationValue values)
Adds a values instance to the results.
|
<T extends Annotation> |
findAnnotation(String annotation)
Find an
AnnotationValue for the given annotation name. |
<T extends Annotation> |
findDeclaredAnnotation(String annotation)
Get all of the values for the given annotation that are directly declared on the annotated element.
|
Set<String> |
getAnnotationNames()
All the annotation names this metadata declares.
|
List<String> |
getAnnotationNamesByStereotype(String stereotype)
Resolve all of the annotation names that feature the given stereotype.
|
Optional<Class<? extends Annotation>> |
getAnnotationType(String name)
Gets the type for a given annotation if it is present on the classpath.
|
<T extends Annotation> |
getAnnotationValuesByType(Class<T> annotationType)
Gets all the annotation values by the given repeatable type.
|
Set<String> |
getDeclaredAnnotationNames()
All the declared annotation names this metadata declares.
|
List<String> |
getDeclaredAnnotationNamesByStereotype(String stereotype)
Resolve all of the annotations names for the given stereotype that are declared annotations.
|
<T extends Annotation> |
getDeclaredAnnotationValuesByType(Class<T> annotationType)
Gets only declared annotation values by the given repeatable type.
|
<T> Optional<T> |
getDefaultValue(String annotation,
String member,
Argument<T> requiredType)
Return the default value for the given annotation member.
|
<T> Optional<T> |
getDefaultValue(String annotation,
String member,
Class<T> requiredType)
Return the default value for the given annotation member.
|
protected abstract Environment |
getEnvironment()
Resolves the
Environment for this metadata. |
<T> OptionalValues<T> |
getValues(String annotation,
Class<T> valueType)
Get all of the values for the given annotation and type of the underlying values.
|
boolean |
hasAnnotation(String annotation)
Checks whether this object has the given annotation on the object itself or inherited from a parent.
|
boolean |
hasDeclaredAnnotation(String annotation)
Checks whether this object has the given annotation directly declared on the object.
|
boolean |
hasDeclaredStereotype(String annotation)
Checks whether this object has the given annotation stereotype on the object itself and not inherited from a parent
|
boolean |
hasStereotype(String annotation)
Checks whether this object has the given annotation stereotype on the object itself or inherited from a parent
|
<T extends Annotation> |
synthesize(Class<T> annotationClass)
Synthesizes a new annotation from the metadata for the given annotation type.
|
Annotation[] |
synthesizeAll()
Synthesizes a new annotations from the metadata.
|
<T extends Annotation> |
synthesizeAnnotationsByType(Class<T> annotationClass)
Synthesizes a new annotations from the metadata for the given type.
|
Annotation[] |
synthesizeDeclared()
Synthesizes a new annotations from the metadata.
|
<T extends Annotation> |
synthesizeDeclared(Class<T> annotationClass)
Synthesizes a new annotation from the metadata for the given annotation type.
|
<T extends Annotation> |
synthesizeDeclaredAnnotationsByType(Class<T> annotationClass)
Synthesizes a new annotations from the metadata for the given type.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclassValue, classValue, classValue, classValue, doubleValue, findAnnotation, findDeclaredAnnotation, getAnnotationNameByStereotype, getAnnotationNameByStereotype, getAnnotationNamesByStereotype, getAnnotationTypeByStereotype, getAnnotationTypeByStereotype, getAnnotationTypesByStereotype, getDeclaredAnnotationNameByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationTypeByStereotype, getDefaultValue, getDefaultValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValues, hasAnnotation, hasDeclaredAnnotation, hasDeclaredStereotype, hasDeclaredStereotype, hasStereotype, hasStereotype, hasStereotype, intValue, isAnnotationPresent, isDeclaredAnnotationPresent, isEmpty, isFalse, isFalse, isPresent, isPresent, isTrue, isTrue, longValuegetAnnotation, getAnnotation, getDeclaredAnnotation, getDeclaredAnnotation, synthesize, synthesizeAll, synthesizeDeclared, synthesizeDeclaredprotected final Map<String,Annotation> annotationMap
protected final Map<String,Annotation> declaredAnnotationMap
protected AbstractEnvironmentAnnotationMetadata(DefaultAnnotationMetadata targetMetadata)
targetMetadata - The target annotation metadatapublic Optional<Class<? extends Annotation>> getAnnotationType(String name)
AnnotationMetadatagetAnnotationType in interface AnnotationMetadataname - The type namepublic <T extends Annotation> List<AnnotationValue<T>> getAnnotationValuesByType(Class<T> annotationType)
AnnotationMetadatagetAnnotationValuesByType in interface AnnotationMetadataT - The annotation typeannotationType - The annotation typepublic <T extends Annotation> List<AnnotationValue<T>> getDeclaredAnnotationValuesByType(Class<T> annotationType)
AnnotationMetadatagetDeclaredAnnotationValuesByType in interface AnnotationMetadataT - The annotation typeannotationType - The annotation typepublic <T extends Annotation> T[] synthesizeAnnotationsByType(Class<T> annotationClass)
AnnotationSourcesynthesizeAnnotationsByType in interface AnnotationSourceT - The annotation generic typeannotationClass - The annotation typepublic <T extends Annotation> T[] synthesizeDeclaredAnnotationsByType(Class<T> annotationClass)
AnnotationSourcesynthesizeDeclaredAnnotationsByType in interface AnnotationSourceT - The annotation generic typeannotationClass - The annotation typepublic boolean hasDeclaredAnnotation(@Nullable String annotation)
AnnotationMetadatahasDeclaredAnnotation in interface AnnotationMetadataannotation - The annotationpublic boolean hasAnnotation(@Nullable String annotation)
AnnotationMetadatahasAnnotation in interface AnnotationMetadataannotation - The annotationpublic boolean hasStereotype(@Nullable String annotation)
AnnotationMetadataChecks whether this object has the given annotation stereotype on the object itself or inherited from a parent
.
An annotation stereotype is a meta annotation potentially applied to another annotation
hasStereotype in interface AnnotationMetadataannotation - The annotationpublic boolean hasDeclaredStereotype(@Nullable String annotation)
AnnotationMetadataChecks whether this object has the given annotation stereotype on the object itself and not inherited from a parent
.
An annotation stereotype is a meta annotation potentially applied to another annotation
hasDeclaredStereotype in interface AnnotationMetadataannotation - The annotationpublic List<String> getAnnotationNamesByStereotype(String stereotype)
AnnotationMetadatagetAnnotationNamesByStereotype in interface AnnotationMetadatastereotype - The annotation namespublic Set<String> getAnnotationNames()
AnnotationMetadatagetAnnotationNames in interface AnnotationMetadatapublic Set<String> getDeclaredAnnotationNames()
AnnotationMetadatagetDeclaredAnnotationNames in interface AnnotationMetadatapublic List<String> getDeclaredAnnotationNamesByStereotype(String stereotype)
AnnotationMetadatagetDeclaredAnnotationNamesByStereotype in interface AnnotationMetadatastereotype - The stereotypepublic <T extends Annotation> Optional<AnnotationValue<T>> findAnnotation(String annotation)
AnnotationSourceAnnotationValue for the given annotation name.findAnnotation in interface AnnotationSourceT - The annotation typeannotation - The annotation nameAnnotationValue instancepublic <T extends Annotation> Optional<AnnotationValue<T>> findDeclaredAnnotation(String annotation)
AnnotationSourcefindDeclaredAnnotation in interface AnnotationSourceT - The annotation typeannotation - The annotation nameAnnotationValue instancepublic <T> OptionalValues<T> getValues(String annotation, Class<T> valueType)
AnnotationMetadatagetValues in interface AnnotationMetadataT - Generic typeannotation - The annotation namevalueType - valueTypeOptionalValuespublic <T> Optional<T> getDefaultValue(String annotation, String member, Class<T> requiredType)
AnnotationMetadatagetDefaultValue in interface AnnotationMetadataT - The required generic typeannotation - The annotationmember - The memberrequiredType - The required typepublic <T> Optional<T> getDefaultValue(String annotation, String member, Argument<T> requiredType)
AnnotationMetadatagetDefaultValue in interface AnnotationMetadataT - The required generic typeannotation - The annotationmember - The memberrequiredType - The required type@Nullable protected abstract Environment getEnvironment()
Environment for this metadata.protected void addValuesToResults(List<AnnotationValue> results, AnnotationValue values)
results - The resultsvalues - The valuespublic <T extends Annotation> T synthesize(Class<T> annotationClass)
AnnotationSourcesynthesize in interface AnnotationSourceT - The annotation generic typeannotationClass - The annotation classpublic <T extends Annotation> T synthesizeDeclared(Class<T> annotationClass)
AnnotationSourceThis method ignores inherited annotations. (Returns null if no annotations are directly present on this element.)
synthesizeDeclared in interface AnnotationSourceT - The annotation generic typeannotationClass - The annotation classpublic Annotation[] synthesizeAll()
AnnotationSourcesynthesizeAll in interface AnnotationSourcepublic Annotation[] synthesizeDeclared()
AnnotationSourcesynthesizeDeclared in interface AnnotationSourceprotected final void addAnnotationValuesFromData(List results, Map<CharSequence,Object> values)
results - The resultsvalues - The values