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 anAnnotationValuefor the given annotation type.default <T extends java.lang.annotation.Annotation>
java.util.Optional<AnnotationValue<T>>findAnnotation(java.lang.String annotation)Find anAnnotationValuefor 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 AnnotationMetadatagetAnnotationMetadata()Supplies the metadata.default booleanisAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)Return whether an annotation is present.default booleanisDeclaredAnnotationPresent(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:AnnotationSourceSynthesizes 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:
synthesizein 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:AnnotationSourceSynthesizes 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:
synthesizeAllin interfaceAnnotationSource- Returns:
- All the annotations
-
synthesizeDeclared
default java.lang.annotation.Annotation[] synthesizeDeclared()
Description copied from interface:AnnotationSourceSynthesizes 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:
synthesizeDeclaredin interfaceAnnotationSource- Returns:
- All declared annotations
-
isAnnotationPresent
default boolean isAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
Description copied from interface:AnnotationSourceReturn whether an annotation is present.- Specified by:
isAnnotationPresentin 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:AnnotationSourceVariation ofAnnotationSource.isAnnotationPresent(Class)for declared annotations.- Specified by:
isDeclaredAnnotationPresentin 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:AnnotationSourceSynthesizes 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:
synthesizeDeclaredin 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:AnnotationSourceSynthesizes 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:
synthesizeAnnotationsByTypein 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:AnnotationSourceSynthesizes 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:
synthesizeDeclaredAnnotationsByTypein 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:AnnotationSourceFind anAnnotationValuefor the given annotation name.- Specified by:
findAnnotationin interfaceAnnotationSource- Type Parameters:
T- The annotation type- Parameters:
annotation- The annotation name- Returns:
- A
AnnotationValueinstance
-
findAnnotation
default <T extends java.lang.annotation.Annotation> java.util.Optional<AnnotationValue<T>> findAnnotation(java.lang.Class<T> annotationClass)
Description copied from interface:AnnotationSourceFind anAnnotationValuefor the given annotation type.- Specified by:
findAnnotationin interfaceAnnotationSource- Type Parameters:
T- The annotation type- Parameters:
annotationClass- The annotation- Returns:
- A
AnnotationValueinstance
-
findDeclaredAnnotation
default <T extends java.lang.annotation.Annotation> java.util.Optional<AnnotationValue<T>> findDeclaredAnnotation(java.lang.String annotation)
Description copied from interface:AnnotationSourceGet all of the values for the given annotation that are directly declared on the annotated element.- Specified by:
findDeclaredAnnotationin interfaceAnnotationSource- Type Parameters:
T- The annotation type- Parameters:
annotation- The annotation name- Returns:
- A
AnnotationValueinstance
-
findDeclaredAnnotation
default <T extends java.lang.annotation.Annotation> java.util.Optional<AnnotationValue<T>> findDeclaredAnnotation(java.lang.Class<T> annotationClass)
Description copied from interface:AnnotationSourceGet all of the 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
-
-