Interface AnnotationMetadata
-
- All Superinterfaces:
AnnotationSource
- All Known Subinterfaces:
AnnotationMetadataDelegate
,BeanIntrospection<T>
,BeanProperty<B,T>
,UnsafeBeanProperty<B,T>
- All Known Implementing Classes:
AbstractBeanIntrospection
,AbstractBeanProperty
public interface AnnotationMetadata extends AnnotationSource
An interface implemented at compile time by Micronaut that allows the inspection of annotation metadata and stereotypes (meta-annotations)
.This interface exposes fast and efficient means to expose annotation data at runtime without requiring reflective tricks to read the annotation metadata
Users of Micronaut should in general avoid the methods of the
AnnotatedElement
interface and use this interface instead to obtain maximum efficiencyCore framework types such as
io.micronaut.inject.BeanDefinition
andio.micronaut.inject.ExecutableMethod
implement this interface- Since:
- 1.0
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CLASS_NAME_SUFFIX
The suffix used when saving compiled metadata to classes.static AnnotationMetadata
EMPTY_METADATA
A constant for representing empty metadata.static java.lang.String
VALUE_MEMBER
The defaultvalue()
member.-
Fields inherited from interface io.micronaut.core.annotation.AnnotationSource
EMPTY
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default java.util.Optional<java.lang.Boolean>
booleanValue(java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
The value as an optional boolean for the given annotation and member.default java.util.Optional<java.lang.Boolean>
booleanValue(java.lang.Class<? extends java.lang.annotation.Annotation> annotation, java.lang.String member)
The value as an optional boolean for the given annotation and member.default java.util.Optional<java.lang.Boolean>
booleanValue(java.lang.String annotation)
The value as an optional boolean for the given annotation and member.default java.util.Optional<java.lang.Boolean>
booleanValue(java.lang.String annotation, java.lang.String member)
The value as an optional boolean for the given annotation and member.default java.util.Optional<java.lang.Class>
classValue(java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
The value of the annotation as a Class.default java.util.Optional<java.lang.Class>
classValue(java.lang.Class<? extends java.lang.annotation.Annotation> annotation, java.lang.String member)
The value of the annotation as a Class.default java.util.Optional<java.lang.Class>
classValue(java.lang.String annotation)
The value of the annotation as a Class.default java.util.Optional<java.lang.Class>
classValue(java.lang.String annotation, java.lang.String member)
The value of the annotation as a Class.default <T> java.lang.Class<T>[]
classValues(java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
The value of the annotation as a Class.default <T> java.lang.Class<T>[]
classValues(java.lang.Class<? extends java.lang.annotation.Annotation> annotation, java.lang.String member)
The value of the annotation as a Class.default <T> java.lang.Class<T>[]
classValues(java.lang.String annotation)
The value of the annotation as a Class.default <T> java.lang.Class<T>[]
classValues(java.lang.String annotation, java.lang.String member)
The value of the annotation as a Class.default java.util.OptionalDouble
doubleValue(java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
The value as anOptionalDouble
for the given annotation and member.default java.util.OptionalDouble
doubleValue(java.lang.Class<? extends java.lang.annotation.Annotation> annotation, java.lang.String member)
The value as anOptionalDouble
for the given annotation and member.default java.util.OptionalDouble
doubleValue(java.lang.String annotation, java.lang.String member)
The value as anOptionalDouble
for the given annotation and member.default <E extends java.lang.Enum>
java.util.Optional<E>enumValue(java.lang.Class<? extends java.lang.annotation.Annotation> annotation, java.lang.Class<E> enumType)
The value of the annotation as a Class.default <E extends java.lang.Enum>
java.util.Optional<E>enumValue(java.lang.Class<? extends java.lang.annotation.Annotation> annotation, java.lang.String member, java.lang.Class<E> enumType)
The value of the annotation as a Class.default <E extends java.lang.Enum>
java.util.Optional<E>enumValue(java.lang.String annotation, java.lang.Class<E> enumType)
The value of the given enum.default <E extends java.lang.Enum>
java.util.Optional<E>enumValue(java.lang.String annotation, java.lang.String member, java.lang.Class<E> enumType)
The value of the annotation as a Class.default <E extends java.lang.Enum>
E[]enumValues(java.lang.Class<? extends java.lang.annotation.Annotation> annotation, java.lang.Class<E> enumType)
The enum values for the given annotation.default <E extends java.lang.Enum>
E[]enumValues(java.lang.Class<? extends java.lang.annotation.Annotation> annotation, java.lang.String member, java.lang.Class<E> enumType)
The enum values for the given annotation.default <E extends java.lang.Enum>
E[]enumValues(java.lang.String annotation, java.lang.Class<E> enumType)
The enum values for the given annotation.default <E extends java.lang.Enum>
E[]enumValues(java.lang.String annotation, java.lang.String member, java.lang.Class<E> enumType)
The enum values for the given annotation.default <T extends java.lang.annotation.Annotation>
java.util.Optional<AnnotationValue<T>>findAnnotation(java.lang.Class<T> annotationClass)
Get all of the values for the given annotation.default <T extends java.lang.annotation.Annotation>
java.util.Optional<AnnotationValue<T>>findDeclaredAnnotation(java.lang.Class<T> annotationClass)
Get all of the values for the given annotation that are directly declared on the annotated element.default java.util.Optional<java.lang.String>
findRepeatableAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
Find repeatable annotation container.default java.util.Optional<java.lang.String>
findRepeatableAnnotation(java.lang.String annotation)
Find repeatable annotation container.default java.util.Optional<java.lang.String>
getAnnotationNameByStereotype(java.lang.Class<? extends java.lang.annotation.Annotation> stereotype)
Find the first annotation name for the given stereotype.default java.util.Optional<java.lang.String>
getAnnotationNameByStereotype(java.lang.String stereotype)
Find the first annotation name for the given stereotype.default java.util.Set<java.lang.String>
getAnnotationNames()
All the annotation names this metadata declares.default java.util.List<java.lang.String>
getAnnotationNamesByStereotype(java.lang.Class<? extends java.lang.annotation.Annotation> stereotype)
Resolve all of the annotation names that feature the given stereotype.default java.util.List<java.lang.String>
getAnnotationNamesByStereotype(java.lang.String stereotype)
Resolve all of the annotation names that feature the given stereotype.default java.util.Optional<java.lang.Class<? extends java.lang.annotation.Annotation>>
getAnnotationType(java.lang.String name)
Gets the type for a given annotation if it is present on the classpath.default java.util.Optional<java.lang.Class<? extends java.lang.annotation.Annotation>>
getAnnotationType(java.lang.String name, java.lang.ClassLoader classLoader)
Gets the type for a given annotation if it is present on the classpath.default java.util.Optional<java.lang.Class<? extends java.lang.annotation.Annotation>>
getAnnotationTypeByStereotype(java.lang.Class<? extends java.lang.annotation.Annotation> stereotype)
Find the first annotation name for the given stereotype.default java.util.Optional<java.lang.Class<? extends java.lang.annotation.Annotation>>
getAnnotationTypeByStereotype(java.lang.String stereotype)
Find the first annotation name for the given stereotype.default java.util.List<java.lang.Class<? extends java.lang.annotation.Annotation>>
getAnnotationTypesByStereotype(java.lang.Class<? extends java.lang.annotation.Annotation> stereotype)
Resolve all of the annotation names that feature the given stereotype.default java.util.List<java.lang.Class<? extends java.lang.annotation.Annotation>>
getAnnotationTypesByStereotype(java.lang.Class<? extends java.lang.annotation.Annotation> stereotype, java.lang.ClassLoader classLoader)
Resolve all of the annotation names that feature the given stereotype.default java.util.List<java.lang.Class<? extends java.lang.annotation.Annotation>>
getAnnotationTypesByStereotype(java.lang.String stereotype)
Resolve all of the annotation names that feature the given stereotype.default <T extends java.lang.annotation.Annotation>
java.util.List<AnnotationValue<T>>getAnnotationValuesByName(java.lang.String annotationType)
Gets all the annotation values by the given repeatable type name.default <T extends java.lang.annotation.Annotation>
java.util.List<AnnotationValue<T>>getAnnotationValuesByStereotype(java.lang.String stereotype)
Resolve all of the annotation values that feature the given stereotype.default <T extends java.lang.annotation.Annotation>
java.util.List<AnnotationValue<T>>getAnnotationValuesByType(java.lang.Class<T> annotationType)
Gets all the annotation values by the given repeatable type.default java.util.Optional<java.lang.String>
getDeclaredAnnotationNameByStereotype(java.lang.String stereotype)
Find the first annotation name for the given stereotype.default java.util.Set<java.lang.String>
getDeclaredAnnotationNames()
All the declared annotation names this metadata declares.default java.util.List<java.lang.String>
getDeclaredAnnotationNamesByStereotype(java.lang.String stereotype)
Resolve all of the annotations names for the given stereotype that are declared annotations.default java.util.Optional<java.lang.Class<? extends java.lang.annotation.Annotation>>
getDeclaredAnnotationTypeByStereotype(java.lang.Class<? extends java.lang.annotation.Annotation> stereotype)
Find the first declared annotation name for the given stereotype.default java.util.Optional<java.lang.Class<? extends java.lang.annotation.Annotation>>
getDeclaredAnnotationTypeByStereotype(java.lang.String stereotype)
Find the first annotation name for the given stereotype.default <T extends java.lang.annotation.Annotation>
java.util.List<AnnotationValue<T>>getDeclaredAnnotationValuesByName(java.lang.String annotationType)
Gets only declared annotation values by the given repeatable type name.default <T extends java.lang.annotation.Annotation>
java.util.List<AnnotationValue<T>>getDeclaredAnnotationValuesByType(java.lang.Class<T> annotationType)
Gets only declared annotation values by the given repeatable type.default AnnotationMetadata
getDeclaredMetadata()
Gets the declared metadata without inherited metdata.default java.util.Set<java.lang.String>
getDeclaredStereotypeAnnotationNames()
Returns the names of the annotations which are declared stereotypes.default <T> java.util.Optional<T>
getDefaultValue(java.lang.Class<? extends java.lang.annotation.Annotation> annotation, java.lang.String member, Argument<T> requiredType)
Return the default value for the given annotation member.default <T> java.util.Optional<T>
getDefaultValue(java.lang.Class<? extends java.lang.annotation.Annotation> annotation, java.lang.String member, java.lang.Class<T> requiredType)
Return the default value for the given annotation member.default <T> java.util.Optional<T>
getDefaultValue(java.lang.String annotation, java.lang.String member, Argument<T> requiredType)
Return the default value for the given annotation member.default <T> java.util.Optional<T>
getDefaultValue(java.lang.String annotation, java.lang.String member, java.lang.Class<T> requiredType)
Return the default value for the given annotation member.default java.util.Map<java.lang.String,java.lang.Object>
getDefaultValues(java.lang.String annotation)
Return the default values for the given annotation name.default java.util.Set<java.lang.String>
getStereotypeAnnotationNames()
Returns the names of the annotations which are stereotypes.default java.util.Optional<java.lang.Object>
getValue(java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
Get the value of default "value" the given annotation.default <T> java.util.Optional<T>
getValue(java.lang.Class<? extends java.lang.annotation.Annotation> annotation, Argument<T> requiredType)
Get the value of default "value" the given annotation.default <T> java.util.Optional<T>
getValue(java.lang.Class<? extends java.lang.annotation.Annotation> annotation, java.lang.Class<T> requiredType)
Get the value of default "value" the given annotation.default java.util.Optional<java.lang.Object>
getValue(java.lang.Class<? extends java.lang.annotation.Annotation> annotation, java.lang.String member)
Get the value of the given annotation member.default <T> java.util.Optional<T>
getValue(java.lang.Class<? extends java.lang.annotation.Annotation> annotation, java.lang.String member, Argument<T> requiredType)
Get the value of the given annotation member.default <T> java.util.Optional<T>
getValue(java.lang.Class<? extends java.lang.annotation.Annotation> annotation, java.lang.String member, java.lang.Class<T> requiredType)
Get the value of the given annotation member.default java.util.Optional<java.lang.Object>
getValue(java.lang.String annotation)
Get the value of default "value" the given annotation.default <T> java.util.Optional<T>
getValue(java.lang.String annotation, Argument<T> requiredType)
Get the value of default "value" the given annotation.default <T> java.util.Optional<T>
getValue(java.lang.String annotation, java.lang.Class<T> requiredType)
Get the value of default "value" the given annotation.default java.util.Optional<java.lang.Object>
getValue(java.lang.String annotation, java.lang.String member)
Get the value of the given annotation member.default <T> java.util.Optional<T>
getValue(java.lang.String annotation, java.lang.String member, Argument<T> requiredType)
Get the value of the given annotation member.default <T> java.util.Optional<T>
getValue(java.lang.String annotation, java.lang.String member, java.lang.Class<T> requiredType)
Get the value of the given annotation member.default <T> OptionalValues<T>
getValues(java.lang.Class<? extends java.lang.annotation.Annotation> annotation, java.lang.Class<T> valueType)
Get all of the values for the given annotation.default java.util.Map<java.lang.CharSequence,java.lang.Object>
getValues(java.lang.String annotation)
Get all of the values for the given annotation and type of the underlying values.default <T> OptionalValues<T>
getValues(java.lang.String annotation, java.lang.Class<T> valueType)
Get all of the values for the given annotation and type of the underlying values.default boolean
hasAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
Checks whether this object has the given annotation on the object itself or inherited from a parent.default boolean
hasAnnotation(java.lang.String annotation)
Checks whether this object has the given annotation on the object itself or inherited from a parent.default boolean
hasDeclaredAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
Checks whether this object has the given annotation directly declared on the object.default boolean
hasDeclaredAnnotation(java.lang.String annotation)
Checks whether this object has the given annotation directly declared on the object.default boolean
hasDeclaredStereotype(java.lang.Class<? extends java.lang.annotation.Annotation> stereotype)
Checks whether this object has the given stereotype directly declared on the object.default boolean
hasDeclaredStereotype(java.lang.Class<? extends java.lang.annotation.Annotation>... annotations)
Checks whether this object has any of the given stereotype directly declared on the object.default boolean
hasDeclaredStereotype(java.lang.String annotation)
Checks whether this object has the given annotation stereotype on the object itself and not inherited from a parentdefault boolean
hasDeclaredStereotype(java.lang.String... annotations)
Checks whether this object has any of the given stereotype directly declared on the object.default boolean
hasPropertyExpressions()
Does the metadata contain any property expressions like${foo.bar}
.default boolean
hasSimpleAnnotation(java.lang.String annotation)
Checks whether the given annotation simple name (name without the package) is present in the annotations.default boolean
hasSimpleDeclaredAnnotation(java.lang.String annotation)
Checks whether the given annotation simple name (name without the package) is present in the declared annotations.default boolean
hasStereotype(java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
Checks whether this object has the given annotation stereotype on the object itself or inherited from a parentdefault boolean
hasStereotype(java.lang.Class<? extends java.lang.annotation.Annotation>... annotations)
Check whether any of the given stereotypes is present.default boolean
hasStereotype(java.lang.String annotation)
Checks whether this object has the given annotation stereotype on the object itself or inherited from a parentdefault boolean
hasStereotype(java.lang.String[] annotations)
Check whether any of the given stereotypes is present.default java.util.OptionalInt
intValue(java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
The value as anOptionalInt
for the given annotation and member.default java.util.OptionalInt
intValue(java.lang.Class<? extends java.lang.annotation.Annotation> annotation, java.lang.String member)
The value as anOptionalInt
for the given annotation and member.default java.util.OptionalInt
intValue(java.lang.String annotation, java.lang.String member)
The value as anOptionalInt
for the given annotation and member.default boolean
isAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
Return whether an annotation is present.default boolean
isAnnotationPresent(java.lang.String annotationName)
Return whether an annotation is present.default boolean
isDeclaredAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
Variation ofAnnotationSource.isAnnotationPresent(Class)
for declared annotations.default boolean
isDeclaredAnnotationPresent(java.lang.String annotationName)
Variation ofAnnotationSource.isAnnotationPresent(String)
for declared annotations.default boolean
isEmpty()
Is the annotation metadata empty.default boolean
isFalse(java.lang.Class<? extends java.lang.annotation.Annotation> annotation, java.lang.String member)
Returns whether the value of the given member is true.default boolean
isFalse(java.lang.String annotation, java.lang.String member)
Returns whether the value of the given member is true.default boolean
isPresent(java.lang.Class<? extends java.lang.annotation.Annotation> annotation, java.lang.String member)
Returns whether the value of the given member is present.default boolean
isPresent(java.lang.String annotation, java.lang.String member)
Returns whether the value of the given member is present.default boolean
isRepeatableAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
Is repeatable annotation?default boolean
isRepeatableAnnotation(java.lang.String annotation)
Is repeatable annotation?default boolean
isTrue(java.lang.Class<? extends java.lang.annotation.Annotation> annotation, java.lang.String member)
Returns whether the value of the given member is true.default boolean
isTrue(java.lang.String annotation, java.lang.String member)
Returns whether the value of the given member is true.default java.util.OptionalLong
longValue(java.lang.Class<? extends java.lang.annotation.Annotation> annotation, java.lang.String member)
The value as anOptionalLong
for the given annotation and member.default java.util.OptionalLong
longValue(java.lang.String annotation, java.lang.String member)
The value as anOptionalLong
for the given annotation and member.default java.util.Optional<java.lang.String>
stringValue(java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
The value as an optional string for the given annotation and member.default java.util.Optional<java.lang.String>
stringValue(java.lang.Class<? extends java.lang.annotation.Annotation> annotation, java.lang.String member)
The value as an optional string for the given annotation and member.default java.util.Optional<java.lang.String>
stringValue(java.lang.String annotation)
The value as an optional string for the given annotation and member.default java.util.Optional<java.lang.String>
stringValue(java.lang.String annotation, java.lang.String member)
The value as an optional string for the given annotation and member.default java.lang.String[]
stringValues(java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
The values as string array for the given annotation and member.default java.lang.String[]
stringValues(java.lang.Class<? extends java.lang.annotation.Annotation> annotation, java.lang.String member)
The values as string array for the given annotation and member.default java.lang.String[]
stringValues(java.lang.String annotation)
The values as string array for the given annotation and member.default java.lang.String[]
stringValues(java.lang.String annotation, java.lang.String member)
The values as string array for the given annotation and member.-
Methods inherited from interface io.micronaut.core.annotation.AnnotationSource
findAnnotation, findDeclaredAnnotation, getAnnotation, getAnnotation, getDeclaredAnnotation, getDeclaredAnnotation, synthesize, synthesize, synthesizeAll, synthesizeAnnotationsByType, synthesizeDeclared, synthesizeDeclared, synthesizeDeclared, synthesizeDeclaredAnnotationsByType
-
-
-
-
Field Detail
-
EMPTY_METADATA
static final AnnotationMetadata EMPTY_METADATA
A constant for representing empty metadata.
-
VALUE_MEMBER
static final java.lang.String VALUE_MEMBER
The defaultvalue()
member.- See Also:
- Constant Field Values
-
CLASS_NAME_SUFFIX
static final java.lang.String CLASS_NAME_SUFFIX
The suffix used when saving compiled metadata to classes.- See Also:
- Constant Field Values
-
-
Method Detail
-
getDeclaredMetadata
@NonNull default AnnotationMetadata getDeclaredMetadata()
Gets the declared metadata without inherited metdata.- Returns:
- The declared metadata
- Since:
- 3.0.0
-
hasPropertyExpressions
default boolean hasPropertyExpressions()
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.- Returns:
- True if property expressions are present
-
getAnnotationNamesByStereotype
@NonNull default java.util.List<java.lang.String> getAnnotationNamesByStereotype(@Nullable java.lang.String stereotype)
Resolve all of the annotation names that feature the given stereotype.- Parameters:
stereotype
- The annotation names- Returns:
- A set of annotation names
-
getAnnotationValuesByStereotype
@NonNull default <T extends java.lang.annotation.Annotation> java.util.List<AnnotationValue<T>> getAnnotationValuesByStereotype(@Nullable java.lang.String stereotype)
Resolve all of the annotation values that feature the given stereotype.- Type Parameters:
T
- The annotation type- Parameters:
stereotype
- The annotation names- Returns:
- A set of annotation names
- Since:
- 3.5.2
-
getAnnotationNames
@NonNull default java.util.Set<java.lang.String> getAnnotationNames()
All the annotation names this metadata declares.- Returns:
- All the annotation names this metadata declares
-
getStereotypeAnnotationNames
@NonNull default java.util.Set<java.lang.String> getStereotypeAnnotationNames()
Returns the names of the annotations which are stereotypes.A stereotype is a meta-annotation (an annotation declared on another annotation).
- Returns:
- The names of the stereotype annotations
- Since:
- 3.4.1
- See Also:
getDeclaredStereotypeAnnotationNames()
-
getDeclaredStereotypeAnnotationNames
@NonNull default java.util.Set<java.lang.String> getDeclaredStereotypeAnnotationNames()
Returns the names of the annotations which are declared stereotypes.A stereotype is a meta-annotation (an annotation declared on another annotation).
A stereotype is considered declared when it it is a meta-annotation that is present on an annotation directly declared on the element and not inherited from a super class.
- Returns:
- The names of the stereotype annotations
- Since:
- 3.4.1
- See Also:
getStereotypeAnnotationNames()
,getDeclaredAnnotationNames()
-
getDeclaredAnnotationNames
@NonNull default java.util.Set<java.lang.String> getDeclaredAnnotationNames()
All the declared annotation names this metadata declares.- Returns:
- All the declared annotation names this metadata declares
-
getDeclaredAnnotationNamesByStereotype
@NonNull default java.util.List<java.lang.String> getDeclaredAnnotationNamesByStereotype(@Nullable java.lang.String stereotype)
Resolve all of the annotations names for the given stereotype that are declared annotations.- Parameters:
stereotype
- The stereotype- Returns:
- The declared annotations
-
getValues
@NonNull default <T> OptionalValues<T> getValues(@NonNull java.lang.String annotation, @NonNull java.lang.Class<T> valueType)
Get all of the values for the given annotation and type of the underlying values.- Type Parameters:
T
- Generic type- Parameters:
annotation
- The annotation namevalueType
- valueType- Returns:
- The
OptionalValues
-
getValues
@NonNull default java.util.Map<java.lang.CharSequence,java.lang.Object> getValues(@NonNull java.lang.String annotation)
Get all of the values for the given annotation and type of the underlying values.- Parameters:
annotation
- The annotation name- Returns:
- An immutable map of values
-
getDefaultValue
default <T> java.util.Optional<T> getDefaultValue(@NonNull java.lang.String annotation, @NonNull java.lang.String member, @NonNull Argument<T> requiredType)
Return the default value for the given annotation member.- Type Parameters:
T
- The required generic type- Parameters:
annotation
- The annotationmember
- The memberrequiredType
- The required type- Returns:
- An optional value
-
getAnnotationValuesByType
@NonNull default <T extends java.lang.annotation.Annotation> java.util.List<AnnotationValue<T>> getAnnotationValuesByType(@NonNull java.lang.Class<T> annotationType)
Gets all the annotation values by the given repeatable type.- Type Parameters:
T
- The annotation type- Parameters:
annotationType
- The annotation type- Returns:
- A list of values
-
getAnnotationValuesByName
@NonNull default <T extends java.lang.annotation.Annotation> java.util.List<AnnotationValue<T>> getAnnotationValuesByName(@NonNull java.lang.String annotationType)
Gets all the annotation values by the given repeatable type name.- Type Parameters:
T
- The annotation type- Parameters:
annotationType
- The annotation type- Returns:
- A list of values
- Since:
- 3.2.4
-
getDeclaredAnnotationValuesByType
@NonNull default <T extends java.lang.annotation.Annotation> java.util.List<AnnotationValue<T>> getDeclaredAnnotationValuesByType(@NonNull java.lang.Class<T> annotationType)
Gets only declared annotation values by the given repeatable type.- Type Parameters:
T
- The annotation type- Parameters:
annotationType
- The annotation type- Returns:
- A list of values
-
getDeclaredAnnotationValuesByName
@NonNull default <T extends java.lang.annotation.Annotation> java.util.List<AnnotationValue<T>> getDeclaredAnnotationValuesByName(@NonNull java.lang.String annotationType)
Gets only declared annotation values by the given repeatable type name.- Type Parameters:
T
- The annotation type- Parameters:
annotationType
- The annotation type- Returns:
- A list of values
- Since:
- 3.2.4
-
hasDeclaredAnnotation
default boolean hasDeclaredAnnotation(@Nullable java.lang.String annotation)
Checks whether this object has the given annotation directly declared on the object.- Parameters:
annotation
- The annotation- Returns:
- True if the annotation is present
-
hasAnnotation
default boolean hasAnnotation(@Nullable java.lang.String annotation)
Checks whether this object has the given annotation on the object itself or inherited from a parent.- Parameters:
annotation
- The annotation- Returns:
- True if the annotation is present
-
hasSimpleAnnotation
default boolean hasSimpleAnnotation(@Nullable java.lang.String annotation)
Checks whether the given annotation simple name (name without the package) is present in the annotations.- Parameters:
annotation
- The annotation- Returns:
- True if the annotation is present
-
hasSimpleDeclaredAnnotation
default boolean hasSimpleDeclaredAnnotation(@Nullable java.lang.String annotation)
Checks whether the given annotation simple name (name without the package) is present in the declared annotations.- Parameters:
annotation
- The annotation- Returns:
- True if the annotation is present
-
hasStereotype
default boolean hasStereotype(@Nullable java.lang.String annotation)
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
- Parameters:
annotation
- The annotation- Returns:
- True if the annotation is present
-
hasDeclaredStereotype
default boolean hasDeclaredStereotype(@Nullable java.lang.String annotation)
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
- Parameters:
annotation
- The annotation- Returns:
- True if the annotation is present
-
hasDeclaredStereotype
default boolean hasDeclaredStereotype(@Nullable java.lang.String... annotations)
Checks whether this object has any of the given stereotype directly declared on the object.- Parameters:
annotations
- The annotations- Returns:
- True if any of the given stereotypes are present
- Since:
- 2.3.3
-
getDefaultValues
@NonNull default java.util.Map<java.lang.String,java.lang.Object> getDefaultValues(@NonNull java.lang.String annotation)
Return the default values for the given annotation name.- Parameters:
annotation
- The annotation name- Returns:
- The default values
-
getDefaultValue
default <T> java.util.Optional<T> getDefaultValue(@NonNull java.lang.String annotation, @NonNull java.lang.String member, @NonNull java.lang.Class<T> requiredType)
Return the default value for the given annotation member.- Type Parameters:
T
- The required generic type- Parameters:
annotation
- The annotationmember
- The memberrequiredType
- The required type- Returns:
- An optional value
-
getDefaultValue
default <T> java.util.Optional<T> getDefaultValue(@NonNull java.lang.Class<? extends java.lang.annotation.Annotation> annotation, @NonNull java.lang.String member, @NonNull Argument<T> requiredType)
Return the default value for the given annotation member.- Type Parameters:
T
- The required generic type- Parameters:
annotation
- The annotationmember
- The memberrequiredType
- The required type- Returns:
- An optional value
-
isAnnotationPresent
default boolean isAnnotationPresent(@NonNull java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
Description copied from interface:AnnotationSource
Return whether an annotation is present.- Specified by:
isAnnotationPresent
in interfaceAnnotationSource
- Parameters:
annotationClass
- The annotation class- Returns:
- True if it is
- See Also:
AnnotationSource.isAnnotationPresent(Class)
-
isDeclaredAnnotationPresent
default boolean isDeclaredAnnotationPresent(@NonNull java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
Description copied from interface:AnnotationSource
Variation ofAnnotationSource.isAnnotationPresent(Class)
for declared annotations.- Specified by:
isDeclaredAnnotationPresent
in interfaceAnnotationSource
- Parameters:
annotationClass
- The annotation class- Returns:
- True if it is
- See Also:
AnnotationSource.isAnnotationPresent(Class)
-
isAnnotationPresent
default boolean isAnnotationPresent(@NonNull java.lang.String annotationName)
Description copied from interface:AnnotationSource
Return whether an annotation is present.- Specified by:
isAnnotationPresent
in interfaceAnnotationSource
- Parameters:
annotationName
- The annotation name- Returns:
- True if it is
- See Also:
AnnotationSource.isAnnotationPresent(String)
-
isDeclaredAnnotationPresent
default boolean isDeclaredAnnotationPresent(@NonNull java.lang.String annotationName)
Description copied from interface:AnnotationSource
Variation ofAnnotationSource.isAnnotationPresent(String)
for declared annotations.- Specified by:
isDeclaredAnnotationPresent
in interfaceAnnotationSource
- Parameters:
annotationName
- The annotation name- Returns:
- True if it is
- See Also:
AnnotationSource.isAnnotationPresent(String)
-
getDefaultValue
default <T> java.util.Optional<T> getDefaultValue(@NonNull java.lang.Class<? extends java.lang.annotation.Annotation> annotation, @NonNull java.lang.String member, @NonNull java.lang.Class<T> requiredType)
Return the default value for the given annotation member.- Type Parameters:
T
- The required generic type- Parameters:
annotation
- The annotationmember
- The memberrequiredType
- The required type- Returns:
- An optional value
-
getValue
default <T> java.util.Optional<T> getValue(@NonNull java.lang.Class<? extends java.lang.annotation.Annotation> annotation, @NonNull java.lang.String member, @NonNull java.lang.Class<T> requiredType)
Get the value of the given annotation member.- Type Parameters:
T
- The value- Parameters:
annotation
- The annotation classmember
- The annotation memberrequiredType
- The required type- Returns:
- An
Optional
of the value
-
getValue
default <T> java.util.Optional<T> getValue(@NonNull java.lang.Class<? extends java.lang.annotation.Annotation> annotation, @NonNull java.lang.String member, @NonNull Argument<T> requiredType)
Get the value of the given annotation member.- Type Parameters:
T
- The value- Parameters:
annotation
- The annotation classmember
- The annotation memberrequiredType
- The required type- Returns:
- An
Optional
of the value
-
getAnnotationNameByStereotype
default java.util.Optional<java.lang.String> getAnnotationNameByStereotype(@Nullable java.lang.String stereotype)
Find the first annotation name for the given stereotype.- Parameters:
stereotype
- The stereotype- Returns:
- The annotation name
-
getDeclaredAnnotationNameByStereotype
default java.util.Optional<java.lang.String> getDeclaredAnnotationNameByStereotype(@Nullable java.lang.String stereotype)
Find the first annotation name for the given stereotype.- Parameters:
stereotype
- The stereotype- Returns:
- The annotation name
-
getAnnotationTypeByStereotype
default java.util.Optional<java.lang.Class<? extends java.lang.annotation.Annotation>> getAnnotationTypeByStereotype(@NonNull java.lang.Class<? extends java.lang.annotation.Annotation> stereotype)
Find the first annotation name for the given stereotype.- Parameters:
stereotype
- The stereotype- Returns:
- The annotation name
-
getDeclaredAnnotationTypeByStereotype
default java.util.Optional<java.lang.Class<? extends java.lang.annotation.Annotation>> getDeclaredAnnotationTypeByStereotype(@NonNull java.lang.Class<? extends java.lang.annotation.Annotation> stereotype)
Find the first declared annotation name for the given stereotype.- Parameters:
stereotype
- The stereotype- Returns:
- The annotation name
-
getDeclaredAnnotationTypeByStereotype
default java.util.Optional<java.lang.Class<? extends java.lang.annotation.Annotation>> getDeclaredAnnotationTypeByStereotype(@Nullable java.lang.String stereotype)
Find the first annotation name for the given stereotype.- Parameters:
stereotype
- The stereotype- Returns:
- The annotation name
-
getAnnotationType
default java.util.Optional<java.lang.Class<? extends java.lang.annotation.Annotation>> getAnnotationType(@NonNull java.lang.String name, @NonNull java.lang.ClassLoader classLoader)
Gets the type for a given annotation if it is present on the classpath. Subclasses can potentially override to provide optimized loading.- Parameters:
name
- The type nameclassLoader
- The ClassLoader to load the type- Returns:
- The type if present
-
getAnnotationType
default java.util.Optional<java.lang.Class<? extends java.lang.annotation.Annotation>> getAnnotationType(@NonNull java.lang.String name)
Gets the type for a given annotation if it is present on the classpath. Subclasses can potentially override to provide optimized loading.- Parameters:
name
- The type name- Returns:
- The type if present
-
getAnnotationTypeByStereotype
default java.util.Optional<java.lang.Class<? extends java.lang.annotation.Annotation>> getAnnotationTypeByStereotype(@Nullable java.lang.String stereotype)
Find the first annotation name for the given stereotype.- Parameters:
stereotype
- The stereotype- Returns:
- The annotation name
-
getAnnotationNameByStereotype
default java.util.Optional<java.lang.String> getAnnotationNameByStereotype(@NonNull java.lang.Class<? extends java.lang.annotation.Annotation> stereotype)
Find the first annotation name for the given stereotype.- Parameters:
stereotype
- The stereotype- Returns:
- The annotation name
-
getValues
@NonNull default <T> OptionalValues<T> getValues(@NonNull java.lang.Class<? extends java.lang.annotation.Annotation> annotation, @NonNull java.lang.Class<T> valueType)
Get all of the values for the given annotation.- Type Parameters:
T
- Generic type- Parameters:
annotation
- The annotation namevalueType
- valueType- Returns:
- The
OptionalValues
-
getAnnotationNamesByStereotype
@NonNull default java.util.List<java.lang.String> getAnnotationNamesByStereotype(@NonNull java.lang.Class<? extends java.lang.annotation.Annotation> stereotype)
Resolve all of the annotation names that feature the given stereotype.- Parameters:
stereotype
- The annotation names- Returns:
- A set of annotation names
-
getAnnotationTypesByStereotype
@NonNull default java.util.List<java.lang.Class<? extends java.lang.annotation.Annotation>> getAnnotationTypesByStereotype(@NonNull java.lang.Class<? extends java.lang.annotation.Annotation> stereotype)
Resolve all of the annotation names that feature the given stereotype.- Parameters:
stereotype
- The annotation names- Returns:
- A set of annotation names
-
getAnnotationTypesByStereotype
@NonNull default java.util.List<java.lang.Class<? extends java.lang.annotation.Annotation>> getAnnotationTypesByStereotype(@NonNull java.lang.String stereotype)
Resolve all of the annotation names that feature the given stereotype.- Parameters:
stereotype
- The annotation names- Returns:
- A set of annotation names
-
getAnnotationTypesByStereotype
@NonNull default java.util.List<java.lang.Class<? extends java.lang.annotation.Annotation>> getAnnotationTypesByStereotype(@NonNull java.lang.Class<? extends java.lang.annotation.Annotation> stereotype, @NonNull java.lang.ClassLoader classLoader)
Resolve all of the annotation names that feature the given stereotype.- Parameters:
stereotype
- The annotation namesclassLoader
- The classloader to load annotation type- Returns:
- A set of annotation names
-
findAnnotation
default <T extends java.lang.annotation.Annotation> java.util.Optional<AnnotationValue<T>> findAnnotation(@NonNull java.lang.Class<T> annotationClass)
Get all of the values for the given annotation.- Specified by:
findAnnotation
in interfaceAnnotationSource
- Type Parameters:
T
- The annotation type- Parameters:
annotationClass
- The annotation name- Returns:
- The
AnnotationValue
-
findDeclaredAnnotation
default <T extends java.lang.annotation.Annotation> java.util.Optional<AnnotationValue<T>> findDeclaredAnnotation(@NonNull java.lang.Class<T> annotationClass)
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:
annotationClass
- The annotation name- Returns:
- A
AnnotationValue
instance
-
getValue
default <T> java.util.Optional<T> getValue(@NonNull java.lang.String annotation, @NonNull java.lang.String member, @NonNull java.lang.Class<T> requiredType)
Get the value of the given annotation member.- Type Parameters:
T
- The value- Parameters:
annotation
- The annotation classmember
- The annotation memberrequiredType
- The required type- Returns:
- An
Optional
of the value
-
getValue
default <T> java.util.Optional<T> getValue(@NonNull java.lang.String annotation, @NonNull java.lang.String member, @NonNull Argument<T> requiredType)
Get the value of the given annotation member.- Type Parameters:
T
- The value- Parameters:
annotation
- The annotation classmember
- The annotation memberrequiredType
- The required type- Returns:
- An
Optional
of the value
-
longValue
default java.util.OptionalLong longValue(@NonNull java.lang.String annotation, @NonNull java.lang.String member)
The value as anOptionalLong
for the given annotation and member.- Parameters:
annotation
- The annotationmember
- The member- Returns:
- THe
OptionalLong
value
-
longValue
default java.util.OptionalLong longValue(@NonNull java.lang.Class<? extends java.lang.annotation.Annotation> annotation, @NonNull java.lang.String member)
The value as anOptionalLong
for the given annotation and member.- Parameters:
annotation
- The annotationmember
- The member- Returns:
- THe
OptionalLong
value
-
enumValue
default <E extends java.lang.Enum> java.util.Optional<E> enumValue(@NonNull java.lang.String annotation, java.lang.Class<E> enumType)
The value of the given enum.- Type Parameters:
E
- The enum type- Parameters:
annotation
- The annotationenumType
- The enum type- Returns:
- An
Optional
enum value
-
enumValue
default <E extends java.lang.Enum> java.util.Optional<E> enumValue(@NonNull java.lang.String annotation, @NonNull java.lang.String member, java.lang.Class<E> enumType)
The value of the annotation as a Class.- Type Parameters:
E
- The enum type- Parameters:
annotation
- The annotationmember
- The annotation memberenumType
- The enum type- Returns:
- An
Optional
class
-
enumValue
default <E extends java.lang.Enum> java.util.Optional<E> enumValue(@NonNull java.lang.Class<? extends java.lang.annotation.Annotation> annotation, java.lang.Class<E> enumType)
The value of the annotation as a Class.- Type Parameters:
E
- The enum type- Parameters:
annotation
- The annotationenumType
- The enum type- Returns:
- An
Optional
class
-
enumValue
default <E extends java.lang.Enum> java.util.Optional<E> enumValue(@NonNull java.lang.Class<? extends java.lang.annotation.Annotation> annotation, @NonNull java.lang.String member, java.lang.Class<E> enumType)
The value of the annotation as a Class.- Type Parameters:
E
- The enum type- Parameters:
annotation
- The annotationmember
- The annotation memberenumType
- The enum type- Returns:
- An
Optional
class
-
enumValues
default <E extends java.lang.Enum> E[] enumValues(@NonNull java.lang.String annotation, java.lang.Class<E> enumType)
The enum values for the given annotation.- Type Parameters:
E
- The enum type- Parameters:
annotation
- The annotationenumType
- The enum type- Returns:
- An array of enum values
-
enumValues
default <E extends java.lang.Enum> E[] enumValues(@NonNull java.lang.String annotation, @NonNull java.lang.String member, java.lang.Class<E> enumType)
The enum values for the given annotation.- Type Parameters:
E
- The enum type- Parameters:
annotation
- The annotationmember
- The annotation memberenumType
- The enum type- Returns:
- An array of enum values
-
enumValues
default <E extends java.lang.Enum> E[] enumValues(@NonNull java.lang.Class<? extends java.lang.annotation.Annotation> annotation, java.lang.Class<E> enumType)
The enum values for the given annotation.- Type Parameters:
E
- The enum type- Parameters:
annotation
- The annotationenumType
- The enum type- Returns:
- An array of enum values
-
enumValues
default <E extends java.lang.Enum> E[] enumValues(@NonNull java.lang.Class<? extends java.lang.annotation.Annotation> annotation, @NonNull java.lang.String member, java.lang.Class<E> enumType)
The enum values for the given annotation.- Type Parameters:
E
- The enum type- Parameters:
annotation
- The annotationmember
- The annotation memberenumType
- The enum type- Returns:
- An array of enum values
-
classValues
@NonNull default <T> java.lang.Class<T>[] classValues(@NonNull java.lang.String annotation)
The value of the annotation as a Class.- Type Parameters:
T
- The type of the class- Parameters:
annotation
- The annotation- Returns:
- An
Optional
class
-
classValues
@NonNull default <T> java.lang.Class<T>[] classValues(@NonNull java.lang.String annotation, @NonNull java.lang.String member)
The value of the annotation as a Class.- Type Parameters:
T
- The type of the class- Parameters:
annotation
- The annotationmember
- The annotation member- Returns:
- An
Optional
class
-
classValues
@NonNull default <T> java.lang.Class<T>[] classValues(@NonNull java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
The value of the annotation as a Class.- Type Parameters:
T
- The type of the class- Parameters:
annotation
- The annotation- Returns:
- An
Optional
class
-
classValues
@NonNull default <T> java.lang.Class<T>[] classValues(@NonNull java.lang.Class<? extends java.lang.annotation.Annotation> annotation, @NonNull java.lang.String member)
The value of the annotation as a Class.- Type Parameters:
T
- The type of the class- Parameters:
annotation
- The annotationmember
- The annotation member- Returns:
- An
Optional
class
-
classValue
default java.util.Optional<java.lang.Class> classValue(@NonNull java.lang.String annotation)
The value of the annotation as a Class.- Parameters:
annotation
- The annotation- Returns:
- An
Optional
class
-
classValue
default java.util.Optional<java.lang.Class> classValue(@NonNull java.lang.String annotation, @NonNull java.lang.String member)
The value of the annotation as a Class.- Parameters:
annotation
- The annotationmember
- The annotation member- Returns:
- An
Optional
class
-
classValue
default java.util.Optional<java.lang.Class> classValue(@NonNull java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
The value of the annotation as a Class.- Parameters:
annotation
- The annotation- Returns:
- An
Optional
class
-
classValue
default java.util.Optional<java.lang.Class> classValue(@NonNull java.lang.Class<? extends java.lang.annotation.Annotation> annotation, @NonNull java.lang.String member)
The value of the annotation as a Class.- Parameters:
annotation
- The annotationmember
- The annotation member- Returns:
- An
Optional
class
-
intValue
default java.util.OptionalInt intValue(@NonNull java.lang.String annotation, @NonNull java.lang.String member)
The value as anOptionalInt
for the given annotation and member.- Parameters:
annotation
- The annotationmember
- The member- Returns:
- THe
OptionalInt
value
-
intValue
default java.util.OptionalInt intValue(@NonNull java.lang.Class<? extends java.lang.annotation.Annotation> annotation, @NonNull java.lang.String member)
The value as anOptionalInt
for the given annotation and member.- Parameters:
annotation
- The annotationmember
- The member- Returns:
- THe
OptionalInt
value
-
intValue
default java.util.OptionalInt intValue(@NonNull java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
The value as anOptionalInt
for the given annotation and member.- Parameters:
annotation
- The annotation- Returns:
- THe
OptionalInt
value
-
stringValue
default java.util.Optional<java.lang.String> stringValue(@NonNull java.lang.String annotation, @NonNull java.lang.String member)
The value as an optional string for the given annotation and member.- Parameters:
annotation
- The annotationmember
- The member- Returns:
- The string value if it is present
-
stringValue
default java.util.Optional<java.lang.String> stringValue(@NonNull java.lang.Class<? extends java.lang.annotation.Annotation> annotation, @NonNull java.lang.String member)
The value as an optional string for the given annotation and member.- Parameters:
annotation
- The annotationmember
- The member- Returns:
- The string value if it is present
-
stringValue
@NonNull default java.util.Optional<java.lang.String> stringValue(@NonNull java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
The value as an optional string for the given annotation and member.- Parameters:
annotation
- The annotation- Returns:
- The string value if it is present
-
stringValue
@NonNull default java.util.Optional<java.lang.String> stringValue(@NonNull java.lang.String annotation)
The value as an optional string for the given annotation and member.- Parameters:
annotation
- The annotation- Returns:
- The string value if it is present
-
booleanValue
default java.util.Optional<java.lang.Boolean> booleanValue(@NonNull java.lang.String annotation, @NonNull java.lang.String member)
The value as an optional boolean for the given annotation and member.- Parameters:
annotation
- The annotationmember
- The member- Returns:
- The string value if it is present
-
booleanValue
default java.util.Optional<java.lang.Boolean> booleanValue(@NonNull java.lang.Class<? extends java.lang.annotation.Annotation> annotation, @NonNull java.lang.String member)
The value as an optional boolean for the given annotation and member.- Parameters:
annotation
- The annotationmember
- The member- Returns:
- The string value if it is present
-
booleanValue
@NonNull default java.util.Optional<java.lang.Boolean> booleanValue(@NonNull java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
The value as an optional boolean for the given annotation and member.- Parameters:
annotation
- The annotation- Returns:
- The string value if it is present
-
booleanValue
@NonNull default java.util.Optional<java.lang.Boolean> booleanValue(@NonNull java.lang.String annotation)
The value as an optional boolean for the given annotation and member.- Parameters:
annotation
- The annotation- Returns:
- The string value if it is present
-
stringValues
@NonNull default java.lang.String[] stringValues(@NonNull java.lang.Class<? extends java.lang.annotation.Annotation> annotation, @NonNull java.lang.String member)
The values as string array for the given annotation and member.- Parameters:
annotation
- The annotationmember
- The member- Returns:
- The string values if it is present
-
stringValues
@NonNull default java.lang.String[] stringValues(@NonNull java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
The values as string array for the given annotation and member.- Parameters:
annotation
- The annotation- Returns:
- The string values if it is present
-
stringValues
@NonNull default java.lang.String[] stringValues(@NonNull java.lang.String annotation, @NonNull java.lang.String member)
The values as string array for the given annotation and member.- Parameters:
annotation
- The annotationmember
- The member- Returns:
- The string values if it is present
-
stringValues
@NonNull default java.lang.String[] stringValues(@NonNull java.lang.String annotation)
The values as string array for the given annotation and member.- Parameters:
annotation
- The annotation- Returns:
- The string values if it is present
-
doubleValue
@NonNull default java.util.OptionalDouble doubleValue(@NonNull java.lang.String annotation, @NonNull java.lang.String member)
The value as anOptionalDouble
for the given annotation and member.- Parameters:
annotation
- The annotationmember
- The member- Returns:
- THe
OptionalDouble
value
-
doubleValue
@NonNull default java.util.OptionalDouble doubleValue(@NonNull java.lang.Class<? extends java.lang.annotation.Annotation> annotation, @NonNull java.lang.String member)
The value as anOptionalDouble
for the given annotation and member.- Parameters:
annotation
- The annotationmember
- The member- Returns:
- THe
OptionalDouble
value
-
doubleValue
@NonNull default java.util.OptionalDouble doubleValue(@NonNull java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
The value as anOptionalDouble
for the given annotation and member.- Parameters:
annotation
- The annotation- Returns:
- THe
OptionalDouble
value
-
getValue
@NonNull default <T> java.util.Optional<T> getValue(@NonNull java.lang.String annotation, @NonNull java.lang.Class<T> requiredType)
Get the value of default "value" the given annotation.- Type Parameters:
T
- The value- Parameters:
annotation
- The annotation classrequiredType
- The required type- Returns:
- An
Optional
of the value
-
getValue
@NonNull default java.util.Optional<java.lang.Object> getValue(@NonNull java.lang.String annotation, @NonNull java.lang.String member)
Get the value of the given annotation member.- Parameters:
annotation
- The annotation classmember
- The annotation member- Returns:
- An
Optional
of the value
-
getValue
@NonNull default java.util.Optional<java.lang.Object> getValue(@NonNull java.lang.Class<? extends java.lang.annotation.Annotation> annotation, @NonNull java.lang.String member)
Get the value of the given annotation member.- Parameters:
annotation
- The annotation classmember
- The annotation member- Returns:
- An
Optional
of the value
-
isTrue
default boolean isTrue(@NonNull java.lang.String annotation, @NonNull java.lang.String member)
Returns whether the value of the given member is true.- Parameters:
annotation
- The annotation classmember
- The annotation member- Returns:
- True if the value is true
-
isTrue
default boolean isTrue(@NonNull java.lang.Class<? extends java.lang.annotation.Annotation> annotation, @NonNull java.lang.String member)
Returns whether the value of the given member is true.- Parameters:
annotation
- The annotation classmember
- The annotation member- Returns:
- True if the value is true
-
isPresent
default boolean isPresent(@NonNull java.lang.String annotation, @NonNull java.lang.String member)
Returns whether the value of the given member is present.- Parameters:
annotation
- The annotation classmember
- The annotation member- Returns:
- True if the value is true
-
isPresent
default boolean isPresent(@NonNull java.lang.Class<? extends java.lang.annotation.Annotation> annotation, @NonNull java.lang.String member)
Returns whether the value of the given member is present.- Parameters:
annotation
- The annotation classmember
- The annotation member- Returns:
- True if the value is true
-
isFalse
default boolean isFalse(@NonNull java.lang.Class<? extends java.lang.annotation.Annotation> annotation, @NonNull java.lang.String member)
Returns whether the value of the given member is true.- Parameters:
annotation
- The annotation classmember
- The annotation member- Returns:
- True if the value is true
-
isFalse
default boolean isFalse(@NonNull java.lang.String annotation, @NonNull java.lang.String member)
Returns whether the value of the given member is true.- Parameters:
annotation
- The annotation classmember
- The annotation member- Returns:
- True if the value is true
-
getValue
@NonNull default java.util.Optional<java.lang.Object> getValue(@NonNull java.lang.String annotation)
Get the value of default "value" the given annotation.- Parameters:
annotation
- The annotation class- Returns:
- An
Optional
of the value
-
getValue
@NonNull default java.util.Optional<java.lang.Object> getValue(@NonNull java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
Get the value of default "value" the given annotation.- Parameters:
annotation
- The annotation class- Returns:
- An
Optional
of the value
-
getValue
@NonNull default <T> java.util.Optional<T> getValue(@NonNull java.lang.Class<? extends java.lang.annotation.Annotation> annotation, @NonNull java.lang.Class<T> requiredType)
Get the value of default "value" the given annotation.- Type Parameters:
T
- Generic type- Parameters:
annotation
- The annotation classrequiredType
- requiredType- Returns:
- An
Optional
of the value
-
getValue
@NonNull default <T> java.util.Optional<T> getValue(@NonNull java.lang.Class<? extends java.lang.annotation.Annotation> annotation, @NonNull Argument<T> requiredType)
Get the value of default "value" the given annotation.- Type Parameters:
T
- Generic type- Parameters:
annotation
- The annotation classrequiredType
- requiredType- Returns:
- An
Optional
of the value
-
getValue
@NonNull default <T> java.util.Optional<T> getValue(@NonNull java.lang.String annotation, @NonNull Argument<T> requiredType)
Get the value of default "value" the given annotation.- Type Parameters:
T
- Generic type- Parameters:
annotation
- The annotation classrequiredType
- requiredType- Returns:
- An
Optional
of the value
-
hasAnnotation
default boolean hasAnnotation(@Nullable java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
Checks whether this object has the given annotation on the object itself or inherited from a parent.- Parameters:
annotation
- The annotation- Returns:
- True if the annotation is present
-
hasStereotype
default boolean hasStereotype(@Nullable java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
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
- Parameters:
annotation
- The annotation- Returns:
- True if the annotation is present
-
hasStereotype
default boolean hasStereotype(@Nullable java.lang.Class<? extends java.lang.annotation.Annotation>... annotations)
Check whether any of the given stereotypes is present.- Parameters:
annotations
- The annotations- Returns:
- True if any of the given stereotypes are present
-
hasStereotype
default boolean hasStereotype(@Nullable java.lang.String[] annotations)
Check whether any of the given stereotypes is present.- Parameters:
annotations
- The annotations- Returns:
- True if any of the given stereotypes are present
-
hasDeclaredAnnotation
default boolean hasDeclaredAnnotation(@Nullable java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
Checks whether this object has the given annotation directly declared on the object.- Parameters:
annotation
- The annotation- Returns:
- True if the annotation is present
-
hasDeclaredStereotype
default boolean hasDeclaredStereotype(@Nullable java.lang.Class<? extends java.lang.annotation.Annotation> stereotype)
Checks whether this object has the given stereotype directly declared on the object.- Parameters:
stereotype
- The annotation- Returns:
- True if the annotation is present
-
hasDeclaredStereotype
default boolean hasDeclaredStereotype(@Nullable java.lang.Class<? extends java.lang.annotation.Annotation>... annotations)
Checks whether this object has any of the given stereotype directly declared on the object.- Parameters:
annotations
- The annotations- Returns:
- True if any of the given stereotypes are present
-
isRepeatableAnnotation
default boolean isRepeatableAnnotation(@NonNull java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
Is repeatable annotation?- Parameters:
annotation
- The annotation- Returns:
- true if repeatable
- Since:
- 3.1
-
isRepeatableAnnotation
default boolean isRepeatableAnnotation(@NonNull java.lang.String annotation)
Is repeatable annotation?- Parameters:
annotation
- The annotation- Returns:
- true if repeatable
- Since:
- 3.1
-
findRepeatableAnnotation
default java.util.Optional<java.lang.String> findRepeatableAnnotation(@NonNull java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
Find repeatable annotation container.- Parameters:
annotation
- The annotation- Returns:
- optional repeatable annotation container
- Since:
- 3.1
-
findRepeatableAnnotation
default java.util.Optional<java.lang.String> findRepeatableAnnotation(@NonNull java.lang.String annotation)
Find repeatable annotation container.- Parameters:
annotation
- The annotation- Returns:
- optional repeatable annotation container
- Since:
- 3.1
-
isEmpty
default boolean isEmpty()
Is the annotation metadata empty.- Returns:
- True if it is
-
-