Interface AnnotationMetadata
- All Superinterfaces:
AnnotationSource
- All Known Subinterfaces:
AbstractAnnotationMetadataBuilder.CachedAnnotationMetadata,AnnotationElement,AnnotationMetadataDelegate,ArrayableClassElement,BeanConstructorElement,BeanDefinition<T>,BeanDefinitionMethodReference<T,,R> BeanDefinitionReference<T>,BeanElement,BeanElementBuilder,BeanFieldElement,BeanIntrospection<T>,BeanMethodElement,BeanParameterElement,BeanProperty<B,,T> BeanReadProperty<B,,T> BeanWriteProperty<B,,T> ClassElement,ConfigurableElement,ConstructorElement,ConstructorInvocationContext<T>,DelegatingBeanDefinition<T>,DelegatingExecutableMethod<T,,R> DisposableBeanDefinition<T>,Element,ElementAnnotationMetadata,ElementMutableAnnotationMetadataDelegate<R>,EnumBeanIntrospection<E>,EnumBeanIntrospection.EnumConstant<E>,EnumConstantElement,EnumElement,ExecutableMethod<T,,R> ExecutionHandle<T,,R> FieldElement,GenericElement,GenericPlaceholderElement,InitializingBeanDefinition<T>,InjectableBeanDefinition<T>,InjectableElement,InstantiatableBeanDefinition<T>,InvocationContext<T,,R> KotlinParameterElement,MemberElement,MethodBasedRouteMatch<T,,R> MethodElement,MethodExecutionHandle<T,,R> MethodInvocationContext<T,,R> MethodReference<T,,R> MutableAnnotationMetadataDelegate<R>,PackageElement,ParameterElement,ParametrizedInstantiatableBeanDefinition<T>,PropertyElement,ProxyBeanDefinition<T>,QualifiedBeanType<T>,RuntimeBeanDefinition<T>,TypedElement,UnsafeBeanInstantiationIntrospection<T>,UnsafeBeanProperty<B,,T> UnsafeBeanReadProperty<B,,T> UnsafeBeanWriteProperty<B,,T> UnsafeExecutionHandle<T,,R> UriRouteMatch<T,,R> ValidatedBeanDefinition<T>,WildcardElement
- All Known Implementing Classes:
AbstractAnnotationElement,AbstractBeanDefinitionBuilder,AbstractBeanProperty,AbstractElementAnnotationMetadata,AbstractElementAnnotationMetadataFactory.AbstractElementAnnotationMetadata,AbstractElementAnnotationMetadataFactory.MutableElementAnnotationMetadata,AbstractEnumBeanIntrospectionAndReference,AbstractEnumBeanIntrospectionAndReference.EnumConstantDynamicRef,AbstractEnumBeanIntrospectionAndReference.EnumConstantRef,AbstractEnvironmentAnnotationMetadata,AbstractExecutableBeanMethod,AbstractExecutableMethod,AbstractGroovyElement,AbstractInitializableBeanDefinition,AbstractInitializableBeanDefinitionAndReference,AbstractInitializableBeanDefinitionReference,AbstractInitializableBeanIntrospection,AbstractInitializableBeanIntrospectionAndReference,AbstractJavaElement,AbstractJavaMemberElement,AbstractMutableAnnotationMetadata,AbstractProviderDefinition,AbstractTypeAwareJavaElement,AnnotationMetadataHierarchy,AnnotationMetadataReference,ApplicationEventPublisherFactory,BeanDefinitionWriter,BeanProviderDefinition,ConstructorInterceptorChain,DefaultAnnotationMetadata,DefaultUriRouteMatch,DisabledBean,EvaluatedAnnotationMetadata,GenericPlaceholderElementAnnotationMetadata,GroovyClassElement,GroovyConstructorElement,GroovyEnumConstantElement,GroovyFieldElement,GroovyMethodElement,GroovyPackageElement,GroovyParameterElement,InterceptorChain,InterceptorRegistryBean,JakartaProviderBeanDefinition,JavaClassElement,JavaMethodElement,JavaPackageElement,JavaxProviderBeanDefinition,MappingAnnotationMetadataDelegate,MethodElementAnnotationMetadata,MethodInterceptorChain,MutableAnnotationMetadata,MutatedMethodElementAnnotationMetadata,PrimitiveElement,PropertyElementAnnotationMetadata,WildcardElementAnnotationMetadata
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 efficiency
Core framework types such as io.micronaut.inject.BeanDefinition and
io.micronaut.inject.ExecutableMethod implement this interface
- Since:
- 1.0
- Author:
- Graeme Rocher
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe suffix used when saving compiled metadata to classes.static final AnnotationMetadataA constant for representing empty metadata.static final StringThe defaultvalue()member.Fields inherited from interface io.micronaut.core.annotation.AnnotationSource
EMPTY -
Method Summary
Modifier and TypeMethodDescriptionbooleanValue(Class<? extends Annotation> annotation) The value as an optional boolean for the given annotation and member.booleanValue(Class<? extends Annotation> annotation, String member) The value as an optional boolean for the given annotation and member.booleanValue(String annotation) The value as an optional boolean for the given annotation and member.booleanValue(String annotation, String member) The value as an optional boolean for the given annotation and member.classValue(Class<? extends Annotation> annotation) The value of the annotation as a Class.classValue(Class<? extends Annotation> annotation, String member) The value of the annotation as a Class.classValue(String annotation) The value of the annotation as a Class.classValue(String annotation, String member) The value of the annotation as a Class.default <T> Class<T>[]classValues(Class<? extends Annotation> annotation) The value of the annotation as a Class.default <T> Class<T>[]classValues(Class<? extends Annotation> annotation, String member) The value of the annotation as a Class.default <T> Class<T>[]classValues(String annotation) The value of the annotation as a Class.default <T> Class<T>[]classValues(String annotation, String member) The value of the annotation as a Class.default AnnotationMetadataMakes a copy of the annotation or returns this.default OptionalDoubledoubleValue(Class<? extends Annotation> annotation) The value as anOptionalDoublefor the given annotation and member.default OptionalDoubledoubleValue(Class<? extends Annotation> annotation, String member) The value as anOptionalDoublefor the given annotation and member.default OptionalDoubledoubleValue(String annotation, String member) The value as anOptionalDoublefor the given annotation and member.enumValue(Class<? extends Annotation> annotation, Class<E> enumType) The value of the annotation as a Class.enumValue(Class<? extends Annotation> annotation, String member, Class<E> enumType) The value of the annotation as a Class.The value of the given enum.The value of the annotation as a Class.default <E extends Enum<E>>
E[]enumValues(Class<? extends Annotation> annotation, Class<E> enumType) The enum values for the given annotation.default <E extends Enum<E>>
E[]enumValues(Class<? extends Annotation> annotation, String member, Class<E> enumType) The enum values for the given annotation.default <E extends Enum<E>>
E[]enumValues(String annotation, Class<E> enumType) The enum values for the given annotation.default <E extends Enum<E>>
E[]enumValues(String annotation, String member, Class<E> enumType) The enum values for the given annotation.enumValuesSet(Class<? extends Annotation> annotation, String member, Class<E> enumType) The enum values for the given annotation.enumValuesSet(String annotation, String member, Class<E> enumType) The enum values for the given annotation.default <T extends Annotation>
Optional<AnnotationValue<T>> findAnnotation(Class<T> annotationClass) Get all values for the given annotation.default <T extends Annotation>
Optional<AnnotationValue<T>> findDeclaredAnnotation(Class<T> annotationClass) Get all 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.getAnnotationNameByStereotype(@Nullable String stereotype) Find the first annotation name for the given stereotype.getAnnotationNameByStereotype(Class<? extends Annotation> stereotype) Find the first annotation name for the given stereotype.All the annotation names this metadata declares.getAnnotationNamesByStereotype(@Nullable String stereotype) Resolve all annotation names that feature the given stereotype.getAnnotationNamesByStereotype(Class<? extends Annotation> stereotype) Resolve all annotation names that feature the given stereotype.default Optional<Class<? extends Annotation>> getAnnotationType(String name) Gets the type for a given annotation if it is present on the classpath.default Optional<Class<? extends Annotation>> getAnnotationType(String name, ClassLoader classLoader) Gets the type for a given annotation if it is present on the classpath.default Optional<Class<? extends Annotation>> getAnnotationTypeByStereotype(@Nullable String stereotype) Find the first annotation name for the given stereotype.default Optional<Class<? extends Annotation>> getAnnotationTypeByStereotype(Class<? extends Annotation> stereotype) Find the first annotation name for the given stereotype.default List<Class<? extends Annotation>> getAnnotationTypesByStereotype(Class<? extends Annotation> stereotype) Resolve all annotation names that feature the given stereotype.default List<Class<? extends Annotation>> getAnnotationTypesByStereotype(Class<? extends Annotation> stereotype, ClassLoader classLoader) Resolve all annotation names that feature the given stereotype.default List<Class<? extends Annotation>> getAnnotationTypesByStereotype(String stereotype) Resolve all annotation names that feature the given stereotype.default <T extends Annotation>
List<AnnotationValue<T>> getAnnotationValuesByName(String annotationType) Gets all the annotation values by the given repeatable type name.default <T extends Annotation>
List<AnnotationValue<T>> getAnnotationValuesByStereotype(@Nullable String stereotype) Resolve all annotation values that feature the given stereotype.default <T extends Annotation>
List<AnnotationValue<T>> getAnnotationValuesByType(Class<T> annotationType) Gets all the annotation values by the given repeatable type.getDeclaredAnnotationNameByStereotype(@Nullable String stereotype) Find the first annotation name for the given stereotype.All the declared annotation names this metadata declares.getDeclaredAnnotationNamesByStereotype(@Nullable String stereotype) Resolve all annotations names for the given stereotype that are declared annotations.default Optional<Class<? extends Annotation>> getDeclaredAnnotationTypeByStereotype(@Nullable String stereotype) Find the first annotation name for the given stereotype.default Optional<Class<? extends Annotation>> getDeclaredAnnotationTypeByStereotype(Class<? extends Annotation> stereotype) Find the first declared annotation name for the given stereotype.default <T extends Annotation>
List<AnnotationValue<T>> getDeclaredAnnotationValuesByName(String annotationType) Gets only declared annotation values by the given repeatable type name.default <T extends Annotation>
List<AnnotationValue<T>> getDeclaredAnnotationValuesByType(Class<T> annotationType) Gets only declared annotation values by the given repeatable type.default AnnotationMetadataGets the declared metadata without inherited metdata.Returns the names of the annotations which are declared stereotypes.default <T> Optional<T> getDefaultValue(Class<? extends Annotation> annotation, String member, Argument<T> requiredType) Return the default value for the given annotation member.default <T> Optional<T> getDefaultValue(Class<? extends Annotation> annotation, String member, Class<T> requiredType) Return the default value for the given annotation member.default <T> Optional<T> getDefaultValue(String annotation, String member, Argument<T> requiredType) Return the default value for the given annotation member.default <T> Optional<T> getDefaultValue(String annotation, String member, Class<T> requiredType) Return the default value for the given annotation member.default Map<CharSequence, Object> getDefaultValues(String annotation) Return the default values for the given annotation name.Returns the names of the annotations which are stereotypes.default AnnotationMetadataUnwraps possible a possible delegate or a provider, returns this otherwise.getValue(Class<? extends Annotation> annotation) Get the value of default "value" the given annotation.default <T> Optional<T> getValue(Class<? extends Annotation> annotation, Argument<T> requiredType) Get the value of default "value" the given annotation.default <T> Optional<T> getValue(Class<? extends Annotation> annotation, Class<T> requiredType) Get the value of default "value" the given annotation.getValue(Class<? extends Annotation> annotation, String member) Get the value of the given annotation member.default <T> Optional<T> getValue(Class<? extends Annotation> annotation, String member, Argument<T> requiredType) Get the value of the given annotation member.default <T> Optional<T> getValue(Class<? extends Annotation> annotation, String member, Class<T> requiredType) Get the value of the given annotation member.Get the value of default "value" the given annotation.default <T> Optional<T> Get the value of default "value" the given annotation.default <T> Optional<T> Get the value of default "value" the given annotation.Get the value of the given annotation member.default <T> Optional<T> Get the value of the given annotation member.default <T> Optional<T> Get the value of the given annotation member.default <T> OptionalValues<T> getValues(Class<? extends Annotation> annotation, Class<T> valueType) Get all values for the given annotation.default Map<CharSequence, Object> Get all values for the given annotation and type of the underlying values.default <T> OptionalValues<T> Get all values for the given annotation and type of the underlying values.default booleanhasAnnotation(@Nullable Class<? extends Annotation> annotation) Checks whether this object has the given annotation on the object itself or inherited from a parent.default booleanhasAnnotation(@Nullable String annotation) Checks whether this object has the given annotation on the object itself or inherited from a parent.default booleanhasDeclaredAnnotation(@Nullable Class<? extends Annotation> annotation) Checks whether this object has the given annotation directly declared on the object.default booleanhasDeclaredAnnotation(@Nullable String annotation) Checks whether this object has the given annotation directly declared on the object.default booleanhasDeclaredStereotype(@Nullable Class<? extends Annotation> stereotype) Checks whether this object has the given stereotype directly declared on the object.default booleanhasDeclaredStereotype(@Nullable String annotation) Checks whether this object has the given annotation stereotype on the object itself and not inherited from a parentdefault booleanhasDeclaredStereotype(@Nullable String... annotations) Checks whether this object has any of the given stereotype directly declared on the object.default booleanhasDeclaredStereotype(Class<? extends Annotation> @Nullable ... annotations) Checks whether this object has any of the given stereotype directly declared on the object.default booleanDoes the metadata contain any evaluated expressions like#{ T(java.lang.Math).random() }.default booleanDoes the metadata contain any property expressions like${foo.bar}.default booleanhasSimpleAnnotation(@Nullable String annotation) Checks whether the given annotation simple name (name without the package) is present in the annotations.default booleanhasSimpleDeclaredAnnotation(@Nullable String annotation) Checks whether the given annotation simple name (name without the package) is present in the declared annotations.default booleanhasStereotype(@Nullable Class<? extends Annotation> annotation) Checks whether this object has the given annotation stereotype on the object itself or inherited from a parentdefault booleanhasStereotype(@Nullable String annotation) Checks whether this object has the given annotation stereotype on the object itself or inherited from a parentdefault booleanhasStereotype(Class<? extends Annotation> @Nullable ... annotations) Check whether any of the given stereotypes is present.default booleanhasStereotype(String @Nullable [] annotations) Check whether any of the given stereotypes is present.default booleanhasStereotypeNonRepeating(Class<? extends Annotation> annotation) Faster version ofhasStereotype(Class)that does not support repeatable annotations.default OptionalIntintValue(Class<? extends Annotation> annotation) The value as anOptionalIntfor the given annotation and member.default OptionalIntintValue(Class<? extends Annotation> annotation, String member) The value as anOptionalIntfor the given annotation and member.default OptionalIntThe value as anOptionalIntfor the given annotation and member.default booleanisAnnotationPresent(Class<? extends Annotation> annotationClass) Return whether an annotation is present.default booleanisAnnotationPresent(String annotationName) Return whether an annotation is present.default booleanisDeclaredAnnotationPresent(Class<? extends Annotation> annotationClass) Variation ofAnnotationSource.isAnnotationPresent(Class)for declared annotations.default booleanisDeclaredAnnotationPresent(String annotationName) Variation ofAnnotationSource.isAnnotationPresent(String)for declared annotations.default booleanisEmpty()Is the annotation metadata empty.default booleanisFalse(Class<? extends Annotation> annotation, String member) Returns whether the value of the given member is true.default booleanReturns whether the value of the given member is true.default booleanisPresent(Class<? extends Annotation> annotation, String member) Returns whether the value of the given member is present.default booleanReturns whether the value of the given member is present.default booleanisRepeatableAnnotation(Class<? extends Annotation> annotation) Is repeatable annotation?default booleanisRepeatableAnnotation(String annotation) Is repeatable annotation?default booleanisTrue(Class<? extends Annotation> annotation, String member) Returns whether the value of the given member is true.default booleanReturns whether the value of the given member is true.default OptionalLonglongValue(Class<? extends Annotation> annotation, String member) The value as anOptionalLongfor the given annotation and member.default OptionalLongThe value as anOptionalLongfor the given annotation and member.stringValue(Class<? extends Annotation> annotation) The value as an optional string for the given annotation and member.stringValue(Class<? extends Annotation> annotation, String member) The value as an optional string for the given annotation and member.stringValue(String annotation) The value as an optional string for the given annotation and member.stringValue(String annotation, String member) The value as an optional string for the given annotation and member.default String[]stringValues(Class<? extends Annotation> annotation) The values as string array for the given annotation and member.default String[]stringValues(Class<? extends Annotation> annotation, String member) The values as string array for the given annotation and member.default String[]stringValues(String annotation) The values as string array for the given annotation and member.default String[]stringValues(String annotation, 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 Details
-
EMPTY_METADATA
A constant for representing empty metadata. -
VALUE_MEMBER
The defaultvalue()member.- See Also:
-
CLASS_NAME_SUFFIX
The suffix used when saving compiled metadata to classes.- See Also:
-
-
Method Details
-
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 returnstrueas 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
-
hasEvaluatedExpressions
default boolean hasEvaluatedExpressions()Does the metadata contain any evaluated expressions like#{ T(java.lang.Math).random() }.- Returns:
- True if evaluated expressions are present
- Since:
- 4.0.0
-
getAnnotationNamesByStereotype
Resolve all annotation names that feature the given stereotype.- Parameters:
stereotype- The annotation names- Returns:
- A set of annotation names
-
getAnnotationValuesByStereotype
default <T extends Annotation> List<AnnotationValue<T>> getAnnotationValuesByStereotype(@Nullable String stereotype) Resolve all 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
All the annotation names this metadata declares.- Returns:
- All the annotation names this metadata declares
-
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
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:
-
getDeclaredAnnotationNames
All the declared annotation names this metadata declares.- Returns:
- All the declared annotation names this metadata declares
-
getDeclaredAnnotationNamesByStereotype
Resolve all annotations names for the given stereotype that are declared annotations.- Parameters:
stereotype- The stereotype- Returns:
- The declared annotations
-
getValues
Get all 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
Get all values for the given annotation and type of the underlying values.- Parameters:
annotation- The annotation name- Returns:
- An immutable map of values
-
getDefaultValue
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
default <T extends Annotation> List<AnnotationValue<T>> getAnnotationValuesByType(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
default <T extends Annotation> List<AnnotationValue<T>> getAnnotationValuesByName(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
default <T extends Annotation> List<AnnotationValue<T>> getDeclaredAnnotationValuesByType(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
default <T extends Annotation> List<AnnotationValue<T>> getDeclaredAnnotationValuesByName(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
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
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
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
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
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
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
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
Return the default values for the given annotation name.- Parameters:
annotation- The annotation name- Returns:
- The default values
-
getDefaultValue
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> Optional<T> getDefaultValue(Class<? extends Annotation> annotation, String member, 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
Description copied from interface:AnnotationSourceReturn whether an annotation is present.- Specified by:
isAnnotationPresentin interfaceAnnotationSource- Parameters:
annotationClass- The annotation class- Returns:
- True if it is
- See Also:
-
isDeclaredAnnotationPresent
Description copied from interface:AnnotationSourceVariation ofAnnotationSource.isAnnotationPresent(Class)for declared annotations.- Specified by:
isDeclaredAnnotationPresentin interfaceAnnotationSource- Parameters:
annotationClass- The annotation class- Returns:
- True if it is
- See Also:
-
isAnnotationPresent
Description copied from interface:AnnotationSourceReturn whether an annotation is present.- Specified by:
isAnnotationPresentin interfaceAnnotationSource- Parameters:
annotationName- The annotation name- Returns:
- True if it is
- See Also:
-
isDeclaredAnnotationPresent
Description copied from interface:AnnotationSourceVariation ofAnnotationSource.isAnnotationPresent(String)for declared annotations.- Specified by:
isDeclaredAnnotationPresentin interfaceAnnotationSource- Parameters:
annotationName- The annotation name- Returns:
- True if it is
- See Also:
-
getDefaultValue
default <T> Optional<T> getDefaultValue(Class<? extends Annotation> annotation, String member, 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> Optional<T> getValue(Class<? extends Annotation> annotation, String member, 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
Optionalof the value
-
getValue
default <T> Optional<T> getValue(Class<? extends Annotation> annotation, String member, 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
Optionalof the value
-
getAnnotationNameByStereotype
Find the first annotation name for the given stereotype.- Parameters:
stereotype- The stereotype- Returns:
- The annotation name
-
getDeclaredAnnotationNameByStereotype
Find the first annotation name for the given stereotype.- Parameters:
stereotype- The stereotype- Returns:
- The annotation name
-
getAnnotationTypeByStereotype
default Optional<Class<? extends Annotation>> getAnnotationTypeByStereotype(Class<? extends Annotation> stereotype) Find the first annotation name for the given stereotype.- Parameters:
stereotype- The stereotype- Returns:
- The annotation name
-
getDeclaredAnnotationTypeByStereotype
default Optional<Class<? extends Annotation>> getDeclaredAnnotationTypeByStereotype(Class<? extends Annotation> stereotype) Find the first declared annotation name for the given stereotype.- Parameters:
stereotype- The stereotype- Returns:
- The annotation name
-
getDeclaredAnnotationTypeByStereotype
default Optional<Class<? extends Annotation>> getDeclaredAnnotationTypeByStereotype(@Nullable String stereotype) Find the first annotation name for the given stereotype.- Parameters:
stereotype- The stereotype- Returns:
- The annotation name
-
getAnnotationType
default Optional<Class<? extends Annotation>> getAnnotationType(String name, 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
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 Optional<Class<? extends Annotation>> getAnnotationTypeByStereotype(@Nullable String stereotype) Find the first annotation name for the given stereotype.- Parameters:
stereotype- The stereotype- Returns:
- The annotation name
-
getAnnotationNameByStereotype
Find the first annotation name for the given stereotype.- Parameters:
stereotype- The stereotype- Returns:
- The annotation name
-
getValues
Get all values for the given annotation.- Type Parameters:
T- Generic type- Parameters:
annotation- The annotation namevalueType- valueType- Returns:
- The
OptionalValues
-
getAnnotationNamesByStereotype
Resolve all annotation names that feature the given stereotype.- Parameters:
stereotype- The annotation names- Returns:
- A set of annotation names
-
getAnnotationTypesByStereotype
default List<Class<? extends Annotation>> getAnnotationTypesByStereotype(Class<? extends Annotation> stereotype) Resolve all annotation names that feature the given stereotype.- Parameters:
stereotype- The annotation names- Returns:
- A set of annotation names
-
getAnnotationTypesByStereotype
Resolve all annotation names that feature the given stereotype.- Parameters:
stereotype- The annotation names- Returns:
- A set of annotation names
-
getAnnotationTypesByStereotype
default List<Class<? extends Annotation>> getAnnotationTypesByStereotype(Class<? extends Annotation> stereotype, ClassLoader classLoader) Resolve all 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 Annotation> Optional<AnnotationValue<T>> findAnnotation(Class<T> annotationClass) Get all values for the given annotation.- Specified by:
findAnnotationin interfaceAnnotationSource- Type Parameters:
T- The annotation type- Parameters:
annotationClass- The annotation name- Returns:
- The
AnnotationValue
-
findDeclaredAnnotation
default <T extends Annotation> Optional<AnnotationValue<T>> findDeclaredAnnotation(Class<T> annotationClass) Description copied from interface:AnnotationSourceGet all values for the given annotation that are directly declared on the annotated element.- Specified by:
findDeclaredAnnotationin interfaceAnnotationSource- Type Parameters:
T- The annotation type- Parameters:
annotationClass- The annotation name- Returns:
- A
AnnotationValueinstance
-
getValue
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
Optionalof the value
-
getValue
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
Optionalof the value
-
longValue
The value as anOptionalLongfor the given annotation and member.- Parameters:
annotation- The annotationmember- The member- Returns:
- THe
OptionalLongvalue
-
longValue
The value as anOptionalLongfor the given annotation and member.- Parameters:
annotation- The annotationmember- The member- Returns:
- THe
OptionalLongvalue
-
enumValue
The value of the given enum.- Type Parameters:
E- The enum type- Parameters:
annotation- The annotationenumType- The enum type- Returns:
- An
Optionalenum value
-
enumValue
default <E extends Enum<E>> Optional<E> enumValue(String annotation, String member, 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
Optionalclass
-
enumValue
default <E extends Enum<E>> Optional<E> enumValue(Class<? extends Annotation> annotation, 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
Optionalclass
-
enumValue
default <E extends Enum<E>> Optional<E> enumValue(Class<? extends Annotation> annotation, String member, 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
Optionalclass
-
enumValues
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
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
-
enumValuesSet
default <E extends Enum<E>> EnumSet<E> enumValuesSet(String annotation, String member, 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 enum set of enum values
- Since:
- 4.0.0
-
enumValues
default <E extends Enum<E>> E[] enumValues(Class<? extends Annotation> annotation, 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 Enum<E>> E[] enumValues(Class<? extends Annotation> annotation, String member, 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
-
enumValuesSet
default <E extends Enum<E>> EnumSet<E> enumValuesSet(Class<? extends Annotation> annotation, String member, 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 enum set of enum values
- Since:
- 4.0.0
-
classValues
The value of the annotation as a Class.- Type Parameters:
T- The type of the class- Parameters:
annotation- The annotation- Returns:
- An
Optionalclass
-
classValues
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
Optionalclass
-
classValues
The value of the annotation as a Class.- Type Parameters:
T- The type of the class- Parameters:
annotation- The annotation- Returns:
- An
Optionalclass
-
classValues
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
Optionalclass
-
classValue
The value of the annotation as a Class.- Parameters:
annotation- The annotation- Returns:
- An
Optionalclass
-
classValue
The value of the annotation as a Class.- Parameters:
annotation- The annotationmember- The annotation member- Returns:
- An
Optionalclass
-
classValue
The value of the annotation as a Class.- Parameters:
annotation- The annotation- Returns:
- An
Optionalclass
-
classValue
The value of the annotation as a Class.- Parameters:
annotation- The annotationmember- The annotation member- Returns:
- An
Optionalclass
-
intValue
The value as anOptionalIntfor the given annotation and member.- Parameters:
annotation- The annotationmember- The member- Returns:
- THe
OptionalIntvalue
-
intValue
The value as anOptionalIntfor the given annotation and member.- Parameters:
annotation- The annotationmember- The member- Returns:
- THe
OptionalIntvalue
-
intValue
The value as anOptionalIntfor the given annotation and member.- Parameters:
annotation- The annotation- Returns:
- THe
OptionalIntvalue
-
stringValue
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
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
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
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
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
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
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
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
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
The values as string array for the given annotation and member.- Parameters:
annotation- The annotation- Returns:
- The string values if it is present
-
stringValues
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
The values as string array for the given annotation and member.- Parameters:
annotation- The annotation- Returns:
- The string values if it is present
-
doubleValue
The value as anOptionalDoublefor the given annotation and member.- Parameters:
annotation- The annotationmember- The member- Returns:
- THe
OptionalDoublevalue
-
doubleValue
The value as anOptionalDoublefor the given annotation and member.- Parameters:
annotation- The annotationmember- The member- Returns:
- THe
OptionalDoublevalue
-
doubleValue
The value as anOptionalDoublefor the given annotation and member.- Parameters:
annotation- The annotation- Returns:
- THe
OptionalDoublevalue
-
getValue
Get the value of default "value" the given annotation.- Type Parameters:
T- The value- Parameters:
annotation- The annotation classrequiredType- The required type- Returns:
- An
Optionalof the value
-
getValue
Get the value of the given annotation member.- Parameters:
annotation- The annotation classmember- The annotation member- Returns:
- An
Optionalof the value
-
getValue
Get the value of the given annotation member.- Parameters:
annotation- The annotation classmember- The annotation member- Returns:
- An
Optionalof the value
-
isTrue
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
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
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
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
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
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
Get the value of default "value" the given annotation.- Parameters:
annotation- The annotation class- Returns:
- An
Optionalof the value
-
getValue
Get the value of default "value" the given annotation.- Parameters:
annotation- The annotation class- Returns:
- An
Optionalof the value
-
getValue
Get the value of default "value" the given annotation.- Type Parameters:
T- Generic type- Parameters:
annotation- The annotation classrequiredType- requiredType- Returns:
- An
Optionalof the value
-
getValue
Get the value of default "value" the given annotation.- Type Parameters:
T- Generic type- Parameters:
annotation- The annotation classrequiredType- requiredType- Returns:
- An
Optionalof the value
-
getValue
Get the value of default "value" the given annotation.- Type Parameters:
T- Generic type- Parameters:
annotation- The annotation classrequiredType- requiredType- Returns:
- An
Optionalof the value
-
hasAnnotation
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
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
-
hasStereotypeNonRepeating
Faster version ofhasStereotype(Class)that does not support repeatable annotations.- Parameters:
annotation- The annotation type- Returns:
- Whether this metadata has the given stereotype
-
hasStereotype
Check whether any of the given stereotypes is present.- Parameters:
annotations- The annotations- Returns:
- True if any of the given stereotypes are present
-
hasStereotype
Check whether any of the given stereotypes is present.- Parameters:
annotations- The annotations- Returns:
- True if any of the given stereotypes are present
-
hasDeclaredAnnotation
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
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
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
Is repeatable annotation?- Parameters:
annotation- The annotation- Returns:
- true if repeatable
- Since:
- 3.1
-
isRepeatableAnnotation
Is repeatable annotation?- Parameters:
annotation- The annotation- Returns:
- true if repeatable
- Since:
- 3.1
-
findRepeatableAnnotation
Find repeatable annotation container.- Parameters:
annotation- The annotation- Returns:
- optional repeatable annotation container
- Since:
- 3.1
-
findRepeatableAnnotation
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
-
copyAnnotationMetadata
Makes a copy of the annotation or returns this.- Returns:
- the copy
- Since:
- 4.0.0
-
getTargetAnnotationMetadata
Unwraps possible a possible delegate or a provider, returns this otherwise.- Specified by:
getTargetAnnotationMetadatain interfaceAnnotationSource- Returns:
- unwrapped
- Since:
- 4.0.0
- See Also:
-