Package io.micronaut.core.annotation
Interface AnnotationMetadataProvider
-
- All Superinterfaces:
AnnotationSource
- All Known Subinterfaces:
AnnotatedElement
,AnnotationMetadataDelegate
,Argument<T>
,ArgumentConversionContext<T>
,ArgumentValue<V>
,BeanConstructor<T>
,BeanIntrospection<T>
,BeanIntrospectionReference<T>
,BeanMethod<B,T>
,BeanProperty<B,T>
,BeanWrapper<T>
,BoundExecutable<T,R>
,ConversionContext
,Executable<T,R>
,GenericPlaceholder<T>
,GraalReflectionConfigurer
,ImmutableArgumentConversionContext<T>
,MutableArgumentValue<V>
,ReturnType<T>
,TypeInformation<T>
,UnsafeBeanProperty<B,T>
- All Known Implementing Classes:
AbstractBeanConstructor
,AbstractBeanIntrospection
,AbstractBeanIntrospectionReference
,AbstractBeanMethod
,AbstractBeanProperty
,DefaultArgument
,GenericArgument
public interface AnnotationMetadataProvider extends AnnotationSource
An interface for a type that providesAnnotationMetadata
.- Since:
- 1.0
-
-
Field Summary
-
Fields inherited from interface io.micronaut.core.annotation.AnnotationSource
EMPTY
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default <T extends java.lang.annotation.Annotation>
java.util.Optional<AnnotationValue<T>>findAnnotation(java.lang.Class<T> annotationClass)
Find anAnnotationValue
for the given annotation type.default <T extends java.lang.annotation.Annotation>
java.util.Optional<AnnotationValue<T>>findAnnotation(java.lang.String annotation)
Find anAnnotationValue
for the given annotation name.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 <T extends java.lang.annotation.Annotation>
java.util.Optional<AnnotationValue<T>>findDeclaredAnnotation(java.lang.String annotation)
Get all of the values for the given annotation that are directly declared on the annotated element.default AnnotationMetadata
getAnnotationMetadata()
Supplies the metadata.default boolean
isAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
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 <T extends java.lang.annotation.Annotation>
Tsynthesize(java.lang.Class<T> annotationClass)
Synthesizes a new annotation from the metadata for the given annotation type.default java.lang.annotation.Annotation[]
synthesizeAll()
Synthesizes a new annotations from the metadata.default <T extends java.lang.annotation.Annotation>
T[]synthesizeAnnotationsByType(java.lang.Class<T> annotationClass)
Synthesizes a new annotations from the metadata for the given type.default java.lang.annotation.Annotation[]
synthesizeDeclared()
Synthesizes a new annotations from the metadata.default <T extends java.lang.annotation.Annotation>
TsynthesizeDeclared(java.lang.Class<T> annotationClass)
Synthesizes a new annotation from the metadata for the given annotation type.default <T extends java.lang.annotation.Annotation>
T[]synthesizeDeclaredAnnotationsByType(java.lang.Class<T> annotationClass)
Synthesizes a new annotations from the metadata for the given type.-
Methods inherited from interface io.micronaut.core.annotation.AnnotationSource
getAnnotation, getAnnotation, getDeclaredAnnotation, getDeclaredAnnotation, isAnnotationPresent, isDeclaredAnnotationPresent, synthesize, synthesizeDeclared
-
-
-
-
Method Detail
-
getAnnotationMetadata
@NonNull default AnnotationMetadata getAnnotationMetadata()
Supplies the metadata. Defaults toAnnotationMetadata.EMPTY_METADATA
.- Returns:
- The
AnnotationMetadata
-
synthesize
default <T extends java.lang.annotation.Annotation> T synthesize(java.lang.Class<T> annotationClass)
Description copied from interface:AnnotationSource
Synthesizes a new annotation from the metadata for the given annotation type. This method works by creating a runtime proxy of the annotation interface and should be avoided in favour of direct use of the annotation metadata and only used for unique cases that require integrating third party libraries.- Specified by:
synthesize
in interfaceAnnotationSource
- Type Parameters:
T
- The annotation generic type- Parameters:
annotationClass
- The annotation class- Returns:
- The annotation or null if it doesn't exist
-
synthesizeAll
default java.lang.annotation.Annotation[] synthesizeAll()
Description copied from interface:AnnotationSource
Synthesizes a new annotations from the metadata. This method works by creating a runtime proxy of the annotation interface and should be avoided in favour of direct use of the annotation metadata and only used for unique cases that require integrating third party libraries.- Specified by:
synthesizeAll
in interfaceAnnotationSource
- Returns:
- All the annotations
-
synthesizeDeclared
default java.lang.annotation.Annotation[] synthesizeDeclared()
Description copied from interface:AnnotationSource
Synthesizes a new annotations from the metadata. This method works by creating a runtime proxy of the annotation interface and should be avoided in favour of direct use of the annotation metadata and only used for unique cases that require integrating third party libraries.- Specified by:
synthesizeDeclared
in interfaceAnnotationSource
- Returns:
- All declared annotations
-
isAnnotationPresent
default boolean isAnnotationPresent(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
-
isDeclaredAnnotationPresent
default boolean isDeclaredAnnotationPresent(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
-
synthesizeDeclared
default <T extends java.lang.annotation.Annotation> T synthesizeDeclared(java.lang.Class<T> annotationClass)
Description copied from interface:AnnotationSource
Synthesizes a new annotation from the metadata for the given annotation type. This method works by creating a runtime proxy of the annotation interface and should be avoided in favour of direct use of the annotation metadata and only used for unique cases that require integrating third party libraries.This method ignores inherited annotations. (Returns null if no annotations are directly present on this element.)
- Specified by:
synthesizeDeclared
in interfaceAnnotationSource
- Type Parameters:
T
- The annotation generic type- Parameters:
annotationClass
- The annotation class- Returns:
- The annotation or null if it doesn't exist
-
synthesizeAnnotationsByType
default <T extends java.lang.annotation.Annotation> T[] synthesizeAnnotationsByType(java.lang.Class<T> annotationClass)
Description copied from interface:AnnotationSource
Synthesizes a new annotations from the metadata for the given type. This method works by creating a runtime proxy of the annotation interface and should be avoided in favour of direct use of the annotation metadata and only used for unique cases that require integrating third party libraries.- Specified by:
synthesizeAnnotationsByType
in interfaceAnnotationSource
- Type Parameters:
T
- The annotation generic type- Parameters:
annotationClass
- The annotation type- Returns:
- All annotations by the given type
-
synthesizeDeclaredAnnotationsByType
default <T extends java.lang.annotation.Annotation> T[] synthesizeDeclaredAnnotationsByType(java.lang.Class<T> annotationClass)
Description copied from interface:AnnotationSource
Synthesizes a new annotations from the metadata for the given type. This method works by creating a runtime proxy of the annotation interface and should be avoided in favour of direct use of the annotation metadata and only used for unique cases that require integrating third party libraries.- Specified by:
synthesizeDeclaredAnnotationsByType
in interfaceAnnotationSource
- Type Parameters:
T
- The annotation generic type- Parameters:
annotationClass
- The annotation type- Returns:
- Declared annotations by the given type
-
findAnnotation
default <T extends java.lang.annotation.Annotation> java.util.Optional<AnnotationValue<T>> findAnnotation(java.lang.String annotation)
Description copied from interface:AnnotationSource
Find anAnnotationValue
for the given annotation name.- Specified by:
findAnnotation
in interfaceAnnotationSource
- Type Parameters:
T
- The annotation type- Parameters:
annotation
- The annotation name- Returns:
- A
AnnotationValue
instance
-
findAnnotation
default <T extends java.lang.annotation.Annotation> java.util.Optional<AnnotationValue<T>> findAnnotation(java.lang.Class<T> annotationClass)
Description copied from interface:AnnotationSource
Find anAnnotationValue
for the given annotation type.- Specified by:
findAnnotation
in interfaceAnnotationSource
- Type Parameters:
T
- The annotation type- Parameters:
annotationClass
- The annotation- Returns:
- A
AnnotationValue
instance
-
findDeclaredAnnotation
default <T extends java.lang.annotation.Annotation> java.util.Optional<AnnotationValue<T>> findDeclaredAnnotation(java.lang.String annotation)
Description copied from interface:AnnotationSource
Get all of the values for the given annotation that are directly declared on the annotated element.- Specified by:
findDeclaredAnnotation
in interfaceAnnotationSource
- Type Parameters:
T
- The annotation type- Parameters:
annotation
- The annotation name- Returns:
- A
AnnotationValue
instance
-
findDeclaredAnnotation
default <T extends java.lang.annotation.Annotation> java.util.Optional<AnnotationValue<T>> findDeclaredAnnotation(java.lang.Class<T> annotationClass)
Description copied from interface:AnnotationSource
Get all of the values for the given annotation that are directly declared on the annotated element.- Specified by:
findDeclaredAnnotation
in interfaceAnnotationSource
- Type Parameters:
T
- The annotation type- Parameters:
annotationClass
- The annotation name- Returns:
- A
AnnotationValue
instance
-
-