Class AnnotationMetadataHierarchy
- All Implemented Interfaces:
AnnotationMetadata
,AnnotationSource
,Iterable<AnnotationMetadata>
AnnotationMetadata
instance passed
to the constructor represents the annotation metadata that is declared, hence methods like hasDeclaredAnnotation(String)
will return true for the last annotation metadata passed in the hierarchy.
This class is used to internally optimize memory usage and compilation time for classes that declare AOP advice at the type level and where the classes methods typically don't include any annotations and therefore would be wasteful to generate additional annotation metadata classes.
- Since:
- 1.3.0
- Author:
- graemerocher
-
Field Summary
Modifier and TypeFieldDescriptionstatic final AnnotationMetadata[]
Constant to represent an empty hierarchy.Fields inherited from interface io.micronaut.core.annotation.AnnotationMetadata
CLASS_NAME_SUFFIX, EMPTY_METADATA, VALUE_MEMBER
Fields inherited from interface io.micronaut.core.annotation.AnnotationSource
EMPTY
-
Constructor Summary
ConstructorDescriptionAnnotationMetadataHierarchy
(boolean delegateDeclaredToAllElements, AnnotationMetadata... hierarchy) Default constructor.AnnotationMetadataHierarchy
(AnnotationMetadata... hierarchy) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionbooleanValue
(@NonNull Class<? extends Annotation> annotation, @NonNull String member, Function<Object, Object> valueMapper) booleanValue
(@NonNull String annotation, @NonNull String member) The value as an optional boolean for the given annotation and member.booleanValue
(@NonNull String annotation, @NonNull String member, @Nullable Function<Object, Object> valueMapper) booleanValue
(Class<? extends Annotation> annotation, String member) The value as an optional boolean for the given annotation and member.classValue
(@NonNull Class<? extends Annotation> annotation, @NonNull String member, Function<Object, Object> valueMapper) classValue
(@NonNull String annotation, @NonNull String member) The value of the annotation as a Class.classValue
(@NonNull String annotation, @NonNull String member, @Nullable Function<Object, Object> valueMapper) classValue
(Class<? extends Annotation> annotation, String member) The value of the annotation as a Class.classValues
(@NonNull String annotation, @NonNull String member) The value of the annotation as a Class.<T> Class<T>[]
classValues
(Class<? extends Annotation> annotation, String member) The value of the annotation as a Class.Makes a copy of the annotation or returns this.Create a new hierarchy instance from this metadata using this metadata's parents.doubleValue
(@NonNull Class<? extends Annotation> annotation, @NonNull String member) The value as anOptionalDouble
for the given annotation and member.doubleValue
(@NonNull Class<? extends Annotation> annotation, @NonNull String member, @Nullable Function<Object, Object> valueMapper) doubleValue
(@NonNull String annotation, @NonNull String member) The value as anOptionalDouble
for the given annotation and member.doubleValue
(@NonNull String annotation, @NonNull String member, Function<Object, Object> valueMapper) enumValue
(@NonNull Class<? extends Annotation> annotation, @NonNull String member, Class<E> enumType) The value of the annotation as a Class.enumValue
(@NonNull Class<? extends Annotation> annotation, @NonNull String member, Class<E> enumType, @Nullable Function<Object, Object> valueMapper) enumValue
(@NonNull String annotation, @NonNull String member, Class<E> enumType, @Nullable Function<Object, Object> valueMapper) The value of the annotation as a Class.<E extends Enum<E>>
E[]enumValues
(@NonNull Class<? extends Annotation> annotation, @NonNull String member, Class<E> enumType, @Nullable Function<Object, Object> valueMapper) <E extends Enum<E>>
E[]enumValues
(@NonNull String annotation, @NonNull String member, Class<E> enumType, @Nullable Function<Object, Object> valueMapper) <E extends Enum<E>>
E[]enumValues
(Class<? extends Annotation> annotation, String member, Class<E> enumType) The enum values for the given annotation.<E extends Enum<E>>
E[]enumValues
(String annotation, String member, Class<E> enumType) The enum values for the given annotation.<T extends Annotation>
@NonNull Optional<AnnotationValue<T>>findAnnotation
(@NonNull String annotation) Find anAnnotationValue
for the given annotation name.<T extends Annotation>
@NonNull Optional<AnnotationValue<T>>findDeclaredAnnotation
(@NonNull String annotation) Get all of the values for the given annotation that are directly declared on the annotated element.findRepeatableAnnotation
(Class<? extends Annotation> annotation) Find repeatable annotation container.findRepeatableAnnotation
(String annotation) Find repeatable annotation container.All the annotation names this metadata declares.getAnnotationNamesByStereotype
(@Nullable String stereotype) Resolve all of the annotation names that feature the given stereotype.Optional<Class<? extends Annotation>>
getAnnotationType
(@NonNull String name) Gets the type for a given annotation if it is present on the classpath.Optional<Class<? extends Annotation>>
getAnnotationType
(@NonNull String name, @NonNull ClassLoader classLoader) Gets the type for a given annotation if it is present on the classpath.<T extends Annotation>
List<AnnotationValue<T>>getAnnotationValuesByName
(String annotationType) Gets all the annotation values by the given repeatable type name.<T extends Annotation>
List<AnnotationValue<T>>getAnnotationValuesByStereotype
(String stereotype) Resolve all of the annotation values that feature the given stereotype.<T extends Annotation>
@NonNull List<AnnotationValue<T>>getAnnotationValuesByType
(@NonNull Class<T> annotationType) Gets all the annotation values by the given repeatable type.All the declared annotation names this metadata declares.<T extends Annotation>
List<AnnotationValue<T>>getDeclaredAnnotationValuesByName
(String annotationType) Gets only declared annotation values by the given repeatable type name.<T extends Annotation>
@NonNull List<AnnotationValue<T>>getDeclaredAnnotationValuesByType
(@NonNull Class<T> annotationType) Gets only declared annotation values by the given repeatable type.Gets the declared metadata without inherited metdata.<T> Optional<T>
getDefaultValue
(@NonNull String annotation, @NonNull String member, @NonNull Argument<T> requiredType) Return the default value for the given annotation member.getDefaultValues
(@NonNull String annotation) Return the default values for the given annotation name.getValue
(@NonNull String annotation, @NonNull String member, @NonNull Argument<T> requiredType, @Nullable Function<Object, Object> valueMapper) <T> @NonNull OptionalValues<T>
Get all of the values for the given annotation and type of the underlying values.boolean
hasAnnotation
(@Nullable String annotation) Checks whether this object has the given annotation on the object itself or inherited from a parent.boolean
hasDeclaredAnnotation
(@Nullable String annotation) Checks whether this object has the given annotation directly declared on the object.boolean
hasDeclaredStereotype
(@Nullable String annotation) Checks whether this object has the given annotation stereotype on the object itself and not inherited from a parentboolean
Does the metadata contain any evaluated expressions like#{ T(java.lang.Math).random() }
.boolean
Does the metadata contain any property expressions like${foo.bar}
.boolean
hasStereotype
(@Nullable String annotation) Checks whether this object has the given annotation stereotype on the object itself or inherited from a parentintValue
(@NonNull Class<? extends Annotation> annotation, @NonNull String member, @Nullable Function<Object, Object> valueMapper) The value as anOptionalInt
for the given annotation and member.intValue
(@NonNull String annotation, @NonNull String member, @Nullable Function<Object, Object> valueMapper) intValue
(Class<? extends Annotation> annotation, String member) The value as anOptionalInt
for the given annotation and member.boolean
isEmpty()
Is the annotation metadata empty.boolean
isFalse
(Class<? extends Annotation> annotation, String member) Returns whether the value of the given member is true.boolean
isPresent
(Class<? extends Annotation> annotation, String member) Returns whether the value of the given member is present.boolean
isRepeatableAnnotation
(Class<? extends Annotation> annotation) Is repeatable annotation?boolean
isRepeatableAnnotation
(String annotation) Is repeatable annotation?boolean
isTrue
(@NonNull Class<? extends Annotation> annotation, @NonNull String member, Function<Object, Object> valueMapper) boolean
Returns whether the value of the given member is true.boolean
isTrue
(@NonNull String annotation, @NonNull String member, @Nullable Function<Object, Object> valueMapper) boolean
isTrue
(Class<? extends Annotation> annotation, String member) Returns whether the value of the given member is true.iterator()
longValue
(@NonNull Class<? extends Annotation> annotation, @NonNull String member, @Nullable Function<Object, Object> valueMapper) The value as anOptionalLong
for the given annotation and member.longValue
(@NonNull String annotation, @NonNull String member, @Nullable Function<Object, Object> valueMapper) longValue
(Class<? extends Annotation> annotation, String member) The value as anOptionalLong
for the given annotation and member.merge()
Merges the hierarchy into oneMutableAnnotationMetadata
.int
size()
The size of the hierarchy.stringValue
(@NonNull Class<? extends Annotation> annotation, @NonNull String member, Function<Object, Object> valueMapper) stringValue
(@NonNull String annotation, @NonNull String member) The value as an optional string for the given annotation and member.stringValue
(@NonNull String annotation, @NonNull String member, @Nullable Function<Object, Object> valueMapper) stringValue
(Class<? extends Annotation> annotation, String member) The value as an optional string for the given annotation and member.stringValues
(@NonNull Class<? extends Annotation> annotation, @NonNull String member) The values as string array for the given annotation and member.stringValues
(@NonNull Class<? extends Annotation> annotation, @NonNull String member, Function<Object, Object> valueMapper) stringValues
(@NonNull String annotation, @NonNull String member) The values as string array for the given annotation and member.String[]
<T extends Annotation>
Tsynthesize
(@NonNull Class<T> annotationClass) Synthesizes a new annotation from the metadata for the given annotation type.<T extends Annotation>
Tsynthesize
(@NonNull Class<T> annotationClass, @NonNull String sourceAnnotation) Synthesizes a new annotation for the given annotation type using the member values of the given source annotation.Synthesizes a new annotations from the metadata.<T extends Annotation>
T[]synthesizeAnnotationsByType
(Class<T> annotationClass) Synthesizes a new annotations from the metadata for the given type.Synthesizes a new annotations from the metadata.<T extends Annotation>
TsynthesizeDeclared
(@NonNull Class<T> annotationClass) Synthesizes a new annotation from the metadata for the given annotation type.<T extends Annotation>
TsynthesizeDeclared
(@NonNull Class<T> annotationClass, @NonNull String sourceAnnotation) Synthesizes a new annotation declared for the given annotation type using the member values of the given source annotation.<T extends Annotation>
T[]synthesizeDeclaredAnnotationsByType
(Class<T> annotationClass) Synthesizes a new annotations from the metadata for the given type.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadata
booleanValue, booleanValue, classValue, classValue, classValues, classValues, doubleValue, enumValue, enumValue, enumValues, enumValues, enumValuesSet, enumValuesSet, findAnnotation, findDeclaredAnnotation, getAnnotationNameByStereotype, getAnnotationNameByStereotype, getAnnotationNamesByStereotype, getAnnotationTypeByStereotype, getAnnotationTypeByStereotype, getAnnotationTypesByStereotype, getAnnotationTypesByStereotype, getAnnotationTypesByStereotype, getDeclaredAnnotationNameByStereotype, getDeclaredAnnotationNamesByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredStereotypeAnnotationNames, getDefaultValue, getDefaultValue, getDefaultValue, getStereotypeAnnotationNames, getTargetAnnotationMetadata, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValues, getValues, hasAnnotation, hasDeclaredAnnotation, hasDeclaredStereotype, hasDeclaredStereotype, hasDeclaredStereotype, hasSimpleAnnotation, hasSimpleDeclaredAnnotation, hasStereotype, hasStereotype, hasStereotype, hasStereotypeNonRepeating, intValue, isAnnotationPresent, isAnnotationPresent, isDeclaredAnnotationPresent, isDeclaredAnnotationPresent, isFalse, isPresent, stringValue, stringValue, stringValues, stringValues
Methods inherited from interface io.micronaut.core.annotation.AnnotationSource
getAnnotation, getAnnotation, getDeclaredAnnotation, getDeclaredAnnotation
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
EMPTY_HIERARCHY
Constant to represent an empty hierarchy.
-
-
Constructor Details
-
AnnotationMetadataHierarchy
Default constructor.- Parameters:
hierarchy
- The annotation hierarchy
-
AnnotationMetadataHierarchy
@Internal public AnnotationMetadataHierarchy(boolean delegateDeclaredToAllElements, AnnotationMetadata... hierarchy) Default constructor.- Parameters:
hierarchy
- The annotation hierarchydelegateDeclaredToAllElements
- The delegate declared to all elements
-
-
Method Details
-
hasPropertyExpressions
public boolean hasPropertyExpressions()Description copied from interface:AnnotationMetadata
Does the metadata contain any property expressions like${foo.bar}
. Note this by default returnstrue
as previous versions of Micronaut must assume metadata is present. The compilation time this is computed in order to decide whether to instrument annotation metadata with environment specific logic.- Specified by:
hasPropertyExpressions
in interfaceAnnotationMetadata
- Returns:
- True if property expressions are present
-
hasEvaluatedExpressions
public boolean hasEvaluatedExpressions()Description copied from interface:AnnotationMetadata
Does the metadata contain any evaluated expressions like#{ T(java.lang.Math).random() }
.- Specified by:
hasEvaluatedExpressions
in interfaceAnnotationMetadata
- Returns:
- True if evaluated expressions are present
-
getAnnotationType
Description copied from interface:AnnotationMetadata
Gets the type for a given annotation if it is present on the classpath. Subclasses can potentially override to provide optimized loading.- Specified by:
getAnnotationType
in interfaceAnnotationMetadata
- Parameters:
name
- The type name- Returns:
- The type if present
-
getAnnotationType
public Optional<Class<? extends Annotation>> getAnnotationType(@NonNull @NonNull String name, @NonNull @NonNull ClassLoader classLoader) Description copied from interface:AnnotationMetadata
Gets the type for a given annotation if it is present on the classpath. Subclasses can potentially override to provide optimized loading.- Specified by:
getAnnotationType
in interfaceAnnotationMetadata
- Parameters:
name
- The type nameclassLoader
- The ClassLoader to load the type- Returns:
- The type if present
-
getDeclaredMetadata
Description copied from interface:AnnotationMetadata
Gets the declared metadata without inherited metdata.- Specified by:
getDeclaredMetadata
in interfaceAnnotationMetadata
- Returns:
- The metadata that is actually declared in the element
-
getRootMetadata
- Returns:
- The metadata that is actually declared in the element
-
createSibling
@NonNull public @NonNull AnnotationMetadata createSibling(@NonNull @NonNull AnnotationMetadata child) Create a new hierarchy instance from this metadata using this metadata's parents.- Parameters:
child
- The child annotation metadata- Returns:
- A new sibling
-
synthesize
@Nullable public <T extends Annotation> T synthesize(@NonNull @NonNull Class<T> annotationClass, @NonNull @NonNull String sourceAnnotation) Description copied from interface:AnnotationSource
Synthesizes a new annotation for the given annotation type using the member values of the given source annotation.This method allows supporting synthesizing annotations that have been renamed, for example a
jakarta.inject.Named
annotation an be synthesized from the metadata of the ajakarta.inject.Named
annotation.- Specified by:
synthesize
in interfaceAnnotationSource
- Type Parameters:
T
- The annotation generic type- Parameters:
annotationClass
- The annotation classsourceAnnotation
- The source annotation that provides the member values- Returns:
- The annotation or null if it doesn't exist
-
synthesizeAll
Description copied from interface:AnnotationSource
Synthesizes a new annotations from the metadata. This method works by creating a runtime proxy of the annotation interface and should be avoided in favour of direct use of the annotation metadata and only used for unique cases that require integrating third party libraries.- Specified by:
synthesizeAll
in interfaceAnnotationSource
- Returns:
- All the annotations
-
synthesizeDeclared
Description copied from interface:AnnotationSource
Synthesizes a new annotations from the metadata. This method works by creating a runtime proxy of the annotation interface and should be avoided in favour of direct use of the annotation metadata and only used for unique cases that require integrating third party libraries.- Specified by:
synthesizeDeclared
in interfaceAnnotationSource
- Returns:
- All declared annotations
-
synthesizeAnnotationsByType
Description copied from interface:AnnotationSource
Synthesizes a new annotations from the metadata for the given type. This method works by creating a runtime proxy of the annotation interface and should be avoided in favour of direct use of the annotation metadata and only used for unique cases that require integrating third party libraries.- Specified by:
synthesizeAnnotationsByType
in interfaceAnnotationSource
- Type Parameters:
T
- The annotation generic type- Parameters:
annotationClass
- The annotation type- Returns:
- All annotations by the given type
-
synthesizeDeclaredAnnotationsByType
Description copied from interface:AnnotationSource
Synthesizes a new annotations from the metadata for the given type. This method works by creating a runtime proxy of the annotation interface and should be avoided in favour of direct use of the annotation metadata and only used for unique cases that require integrating third party libraries.- Specified by:
synthesizeDeclaredAnnotationsByType
in interfaceAnnotationSource
- Type Parameters:
T
- The annotation generic type- Parameters:
annotationClass
- The annotation type- Returns:
- Declared annotations by the given type
-
synthesizeDeclared
@Nullable public <T extends Annotation> T synthesizeDeclared(@NonNull @NonNull Class<T> annotationClass, @NonNull @NonNull String sourceAnnotation) Description copied from interface:AnnotationSource
Synthesizes a new annotation declared for the given annotation type using the member values of the given source annotation.This method allows supporting synthesizing annotations that have been renamed, for example a
jakarta.inject.Named
annotation an be synthesized from the metadata of the ajakarta.inject.Named
annotation.- Specified by:
synthesizeDeclared
in interfaceAnnotationSource
- Type Parameters:
T
- The annotation generic type- Parameters:
annotationClass
- The annotation classsourceAnnotation
- The source annotation that provides the member values- Returns:
- The annotation or null if it doesn't exist
-
synthesize
Description copied from interface:AnnotationSource
Synthesizes a new annotation from the metadata for the given annotation type. This method works by creating a runtime proxy of the annotation interface and should be avoided in favour of direct use of the annotation metadata and only used for unique cases that require integrating third party libraries.- Specified by:
synthesize
in interfaceAnnotationSource
- Type Parameters:
T
- The annotation generic type- Parameters:
annotationClass
- The annotation class- Returns:
- The annotation or null if it doesn't exist
-
synthesizeDeclared
@Nullable public <T extends Annotation> T synthesizeDeclared(@NonNull @NonNull Class<T> annotationClass) Description copied from interface:AnnotationSource
Synthesizes a new annotation from the metadata for the given annotation type. This method works by creating a runtime proxy of the annotation interface and should be avoided in favour of direct use of the annotation metadata and only used for unique cases that require integrating third party libraries.This method ignores inherited annotations. (Returns null if no annotations are directly present on this element.)
- Specified by:
synthesizeDeclared
in interfaceAnnotationSource
- Type Parameters:
T
- The annotation generic type- Parameters:
annotationClass
- The annotation class- Returns:
- The annotation or null if it doesn't exist
-
findAnnotation
@NonNull public <T extends Annotation> @NonNull Optional<AnnotationValue<T>> findAnnotation(@NonNull @NonNull String annotation) Description copied from interface:AnnotationSource
Find anAnnotationValue
for the given annotation name.- Specified by:
findAnnotation
in interfaceAnnotationSource
- Type Parameters:
T
- The annotation type- Parameters:
annotation
- The annotation name- Returns:
- A
AnnotationValue
instance
-
findDeclaredAnnotation
@NonNull public <T extends Annotation> @NonNull Optional<AnnotationValue<T>> findDeclaredAnnotation(@NonNull @NonNull String annotation) Description copied from interface:AnnotationSource
Get all of the values for the given annotation that are directly declared on the annotated element.- Specified by:
findDeclaredAnnotation
in interfaceAnnotationSource
- Type Parameters:
T
- The annotation type- Parameters:
annotation
- The annotation name- Returns:
- A
AnnotationValue
instance
-
doubleValue
@NonNull public @NonNull OptionalDouble doubleValue(@NonNull @NonNull Class<? extends Annotation> annotation, @NonNull @NonNull String member) Description copied from interface:AnnotationMetadata
The value as anOptionalDouble
for the given annotation and member.- Specified by:
doubleValue
in interfaceAnnotationMetadata
- Parameters:
annotation
- The annotationmember
- The member- Returns:
- THe
OptionalDouble
value
-
stringValues
@NonNull public @NonNull String[] stringValues(@NonNull @NonNull Class<? extends Annotation> annotation, @NonNull @NonNull String member) Description copied from interface:AnnotationMetadata
The values as string array for the given annotation and member.- Specified by:
stringValues
in interfaceAnnotationMetadata
- Parameters:
annotation
- The annotationmember
- The member- Returns:
- The string values if it is present
-
stringValues
@NonNull public @NonNull String[] stringValues(@NonNull @NonNull String annotation, @NonNull @NonNull String member) Description copied from interface:AnnotationMetadata
The values as string array for the given annotation and member.- Specified by:
stringValues
in interfaceAnnotationMetadata
- Parameters:
annotation
- The annotationmember
- The member- Returns:
- The string values if it is present
-
booleanValue
public Optional<Boolean> booleanValue(@NonNull @NonNull String annotation, @NonNull @NonNull String member) Description copied from interface:AnnotationMetadata
The value as an optional boolean for the given annotation and member.- Specified by:
booleanValue
in interfaceAnnotationMetadata
- Parameters:
annotation
- The annotationmember
- The member- Returns:
- The string value if it is present
-
isTrue
Description copied from interface:AnnotationMetadata
Returns whether the value of the given member is true.- Specified by:
isTrue
in interfaceAnnotationMetadata
- Parameters:
annotation
- The annotation classmember
- The annotation member- Returns:
- True if the value is true
-
longValue
Description copied from interface:AnnotationMetadata
The value as anOptionalLong
for the given annotation and member.- Specified by:
longValue
in interfaceAnnotationMetadata
- Parameters:
annotation
- The annotationmember
- The member- Returns:
- THe
OptionalLong
value
-
stringValue
public Optional<String> stringValue(@NonNull @NonNull String annotation, @NonNull @NonNull String member) Description copied from interface:AnnotationMetadata
The value as an optional string for the given annotation and member.- Specified by:
stringValue
in interfaceAnnotationMetadata
- Parameters:
annotation
- The annotationmember
- The member- Returns:
- The string value if it is present
-
intValue
Description copied from interface:AnnotationMetadata
The value as anOptionalInt
for the given annotation and member.- Specified by:
intValue
in interfaceAnnotationMetadata
- Parameters:
annotation
- The annotationmember
- The member- Returns:
- THe
OptionalInt
value
-
doubleValue
@NonNull public @NonNull OptionalDouble doubleValue(@NonNull @NonNull String annotation, @NonNull @NonNull String member) Description copied from interface:AnnotationMetadata
The value as anOptionalDouble
for the given annotation and member.- Specified by:
doubleValue
in interfaceAnnotationMetadata
- Parameters:
annotation
- The annotationmember
- The member- Returns:
- THe
OptionalDouble
value
-
enumValue
public <E extends Enum<E>> Optional<E> enumValue(@NonNull @NonNull Class<? extends Annotation> annotation, @NonNull @NonNull String member, Class<E> enumType) Description copied from interface:AnnotationMetadata
The value of the annotation as a Class.- Specified by:
enumValue
in interfaceAnnotationMetadata
- Type Parameters:
E
- The enum type- Parameters:
annotation
- The annotationmember
- The annotation memberenumType
- The enum type- Returns:
- An
Optional
class
-
classValues
@NonNull public <T> @NonNull Class<T>[] classValues(@NonNull @NonNull String annotation, @NonNull @NonNull String member) Description copied from interface:AnnotationMetadata
The value of the annotation as a Class.- Specified by:
classValues
in interfaceAnnotationMetadata
- Type Parameters:
T
- The type of the class- Parameters:
annotation
- The annotationmember
- The annotation member- Returns:
- An
Optional
class
-
classValue
public Optional<Class> classValue(@NonNull @NonNull String annotation, @NonNull @NonNull String member) Description copied from interface:AnnotationMetadata
The value of the annotation as a Class.- Specified by:
classValue
in interfaceAnnotationMetadata
- Parameters:
annotation
- The annotationmember
- The annotation member- Returns:
- An
Optional
class
-
getAnnotationNamesByStereotype
@NonNull public @NonNull List<String> getAnnotationNamesByStereotype(@Nullable @Nullable String stereotype) Description copied from interface:AnnotationMetadata
Resolve all of the annotation names that feature the given stereotype.- Specified by:
getAnnotationNamesByStereotype
in interfaceAnnotationMetadata
- Parameters:
stereotype
- The annotation names- Returns:
- A set of annotation names
-
getAnnotationValuesByStereotype
public <T extends Annotation> List<AnnotationValue<T>> getAnnotationValuesByStereotype(String stereotype) Description copied from interface:AnnotationMetadata
Resolve all of the annotation values that feature the given stereotype.- Specified by:
getAnnotationValuesByStereotype
in interfaceAnnotationMetadata
- Type Parameters:
T
- The annotation type- Parameters:
stereotype
- The annotation names- Returns:
- A set of annotation names
-
getDeclaredAnnotationNames
Description copied from interface:AnnotationMetadata
All the declared annotation names this metadata declares.- Specified by:
getDeclaredAnnotationNames
in interfaceAnnotationMetadata
- Returns:
- All the declared annotation names this metadata declares
-
getAnnotationNames
Description copied from interface:AnnotationMetadata
All the annotation names this metadata declares.- Specified by:
getAnnotationNames
in interfaceAnnotationMetadata
- Returns:
- All the annotation names this metadata declares
-
getValues
@NonNull public <T> @NonNull OptionalValues<T> getValues(@NonNull @NonNull String annotation, @NonNull @NonNull Class<T> valueType) Description copied from interface:AnnotationMetadata
Get all of the values for the given annotation and type of the underlying values.- Specified by:
getValues
in interfaceAnnotationMetadata
- Type Parameters:
T
- Generic type- Parameters:
annotation
- The annotation namevalueType
- valueType- Returns:
- The
OptionalValues
-
getDefaultValue
public <T> Optional<T> getDefaultValue(@NonNull @NonNull String annotation, @NonNull @NonNull String member, @NonNull @NonNull Argument<T> requiredType) Description copied from interface:AnnotationMetadata
Return the default value for the given annotation member.- Specified by:
getDefaultValue
in interfaceAnnotationMetadata
- Type Parameters:
T
- The required generic type- Parameters:
annotation
- The annotationmember
- The memberrequiredType
- The required type- Returns:
- An optional value
-
getAnnotationValuesByType
@NonNull public <T extends Annotation> @NonNull List<AnnotationValue<T>> getAnnotationValuesByType(@NonNull @NonNull Class<T> annotationType) Description copied from interface:AnnotationMetadata
Gets all the annotation values by the given repeatable type.- Specified by:
getAnnotationValuesByType
in interfaceAnnotationMetadata
- Type Parameters:
T
- The annotation type- Parameters:
annotationType
- The annotation type- Returns:
- A list of values
-
getAnnotationValuesByName
public <T extends Annotation> List<AnnotationValue<T>> getAnnotationValuesByName(String annotationType) Description copied from interface:AnnotationMetadata
Gets all the annotation values by the given repeatable type name.- Specified by:
getAnnotationValuesByName
in interfaceAnnotationMetadata
- Type Parameters:
T
- The annotation type- Parameters:
annotationType
- The annotation type- Returns:
- A list of values
-
getDeclaredAnnotationValuesByType
@NonNull public <T extends Annotation> @NonNull List<AnnotationValue<T>> getDeclaredAnnotationValuesByType(@NonNull @NonNull Class<T> annotationType) Description copied from interface:AnnotationMetadata
Gets only declared annotation values by the given repeatable type.- Specified by:
getDeclaredAnnotationValuesByType
in interfaceAnnotationMetadata
- Type Parameters:
T
- The annotation type- Parameters:
annotationType
- The annotation type- Returns:
- A list of values
-
getDeclaredAnnotationValuesByName
public <T extends Annotation> List<AnnotationValue<T>> getDeclaredAnnotationValuesByName(String annotationType) Description copied from interface:AnnotationMetadata
Gets only declared annotation values by the given repeatable type name.- Specified by:
getDeclaredAnnotationValuesByName
in interfaceAnnotationMetadata
- Type Parameters:
T
- The annotation type- Parameters:
annotationType
- The annotation type- Returns:
- A list of values
-
hasDeclaredAnnotation
Description copied from interface:AnnotationMetadata
Checks whether this object has the given annotation directly declared on the object.- Specified by:
hasDeclaredAnnotation
in interfaceAnnotationMetadata
- Parameters:
annotation
- The annotation- Returns:
- True if the annotation is present
-
hasAnnotation
Description copied from interface:AnnotationMetadata
Checks whether this object has the given annotation on the object itself or inherited from a parent.- Specified by:
hasAnnotation
in interfaceAnnotationMetadata
- Parameters:
annotation
- The annotation- Returns:
- True if the annotation is present
-
hasStereotype
Description copied from interface:AnnotationMetadata
Checks 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
- Specified by:
hasStereotype
in interfaceAnnotationMetadata
- Parameters:
annotation
- The annotation- Returns:
- True if the annotation is present
-
hasDeclaredStereotype
Description copied from interface:AnnotationMetadata
Checks 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
- Specified by:
hasDeclaredStereotype
in interfaceAnnotationMetadata
- Parameters:
annotation
- The annotation- Returns:
- True if the annotation is present
-
enumValue
public <E extends Enum<E>> Optional<E> enumValue(String annotation, String member, Class<E> enumType) Description copied from interface:AnnotationMetadata
The value of the annotation as a Class.- Specified by:
enumValue
in interfaceAnnotationMetadata
- Type Parameters:
E
- The enum type- Parameters:
annotation
- The annotationmember
- The annotation memberenumType
- The enum type- Returns:
- An
Optional
class
-
enumValues
Description copied from interface:AnnotationMetadata
The enum values for the given annotation.- Specified by:
enumValues
in interfaceAnnotationMetadata
- Type Parameters:
E
- The enum type- Parameters:
annotation
- The annotationmember
- The annotation memberenumType
- The enum type- Returns:
- An array of enum values
-
intValue
Description copied from interface:AnnotationMetadata
The value as anOptionalInt
for the given annotation and member.- Specified by:
intValue
in interfaceAnnotationMetadata
- Parameters:
annotation
- The annotationmember
- The member- Returns:
- THe
OptionalInt
value
-
isFalse
Description copied from interface:AnnotationMetadata
Returns whether the value of the given member is true.- Specified by:
isFalse
in interfaceAnnotationMetadata
- Parameters:
annotation
- The annotation classmember
- The annotation member- Returns:
- True if the value is true
-
getDefaultValues
@NonNull public @NonNull Map<CharSequence,Object> getDefaultValues(@NonNull @NonNull String annotation) Description copied from interface:AnnotationMetadata
Return the default values for the given annotation name.- Specified by:
getDefaultValues
in interfaceAnnotationMetadata
- Parameters:
annotation
- The annotation name- Returns:
- The default values
-
enumValue
-
enumValue
-
enumValues
-
enumValues
-
classValue
-
classValue
-
intValue
-
booleanValue
-
booleanValue
-
longValue
-
longValue
-
intValue
-
longValue
Description copied from interface:AnnotationMetadata
The value as anOptionalLong
for the given annotation and member.- Specified by:
longValue
in interfaceAnnotationMetadata
- Parameters:
annotation
- The annotationmember
- The member- Returns:
- THe
OptionalLong
value
-
enumValues
public <E extends Enum<E>> E[] enumValues(Class<? extends Annotation> annotation, String member, Class<E> enumType) Description copied from interface:AnnotationMetadata
The enum values for the given annotation.- Specified by:
enumValues
in interfaceAnnotationMetadata
- Type Parameters:
E
- The enum type- Parameters:
annotation
- The annotationmember
- The annotation memberenumType
- The enum type- Returns:
- An array of enum values
-
classValues
Description copied from interface:AnnotationMetadata
The value of the annotation as a Class.- Specified by:
classValues
in interfaceAnnotationMetadata
- Type Parameters:
T
- The type of the class- Parameters:
annotation
- The annotationmember
- The annotation member- Returns:
- An
Optional
class
-
classValue
Description copied from interface:AnnotationMetadata
The value of the annotation as a Class.- Specified by:
classValue
in interfaceAnnotationMetadata
- Parameters:
annotation
- The annotationmember
- The annotation member- Returns:
- An
Optional
class
-
stringValue
Description copied from interface:AnnotationMetadata
The value as an optional string for the given annotation and member.- Specified by:
stringValue
in interfaceAnnotationMetadata
- Parameters:
annotation
- The annotationmember
- The member- Returns:
- The string value if it is present
-
booleanValue
Description copied from interface:AnnotationMetadata
The value as an optional boolean for the given annotation and member.- Specified by:
booleanValue
in interfaceAnnotationMetadata
- Parameters:
annotation
- The annotationmember
- The member- Returns:
- The string value if it is present
-
isTrue
Description copied from interface:AnnotationMetadata
Returns whether the value of the given member is true.- Specified by:
isTrue
in interfaceAnnotationMetadata
- Parameters:
annotation
- The annotation classmember
- The annotation member- Returns:
- True if the value is true
-
isPresent
Description copied from interface:AnnotationMetadata
Returns whether the value of the given member is present.- Specified by:
isPresent
in interfaceAnnotationMetadata
- Parameters:
annotation
- The annotation classmember
- The annotation member- Returns:
- True if the value is true
-
stringValue
-
stringValues
-
stringValues
-
stringValue
-
isTrue
-
isTrue
-
doubleValue
-
doubleValue
-
getValue
-
iterator
- Specified by:
iterator
in interfaceIterable<AnnotationMetadata>
-
isEmpty
public boolean isEmpty()Description copied from interface:AnnotationMetadata
Is the annotation metadata empty.- Specified by:
isEmpty
in interfaceAnnotationMetadata
- Returns:
- True if it is
-
isRepeatableAnnotation
Description copied from interface:AnnotationMetadata
Is repeatable annotation?- Specified by:
isRepeatableAnnotation
in interfaceAnnotationMetadata
- Parameters:
annotation
- The annotation- Returns:
- true if repeatable
-
isRepeatableAnnotation
Description copied from interface:AnnotationMetadata
Is repeatable annotation?- Specified by:
isRepeatableAnnotation
in interfaceAnnotationMetadata
- Parameters:
annotation
- The annotation- Returns:
- true if repeatable
-
findRepeatableAnnotation
Description copied from interface:AnnotationMetadata
Find repeatable annotation container.- Specified by:
findRepeatableAnnotation
in interfaceAnnotationMetadata
- Parameters:
annotation
- The annotation- Returns:
- optional repeatable annotation container
-
findRepeatableAnnotation
Description copied from interface:AnnotationMetadata
Find repeatable annotation container.- Specified by:
findRepeatableAnnotation
in interfaceAnnotationMetadata
- Parameters:
annotation
- The annotation- Returns:
- optional repeatable annotation container
-
merge
Merges the hierarchy into oneMutableAnnotationMetadata
.- Returns:
- merged metadata
- Since:
- 4.0.0
-
copyAnnotationMetadata
Description copied from interface:AnnotationMetadata
Makes a copy of the annotation or returns this.- Specified by:
copyAnnotationMetadata
in interfaceAnnotationMetadata
- Returns:
- the copy
-
size
public int size()The size of the hierarchy.- Returns:
- The size
- Since:
- 4.0.0
-