Package io.micronaut.inject.ast
Interface Element
- All Superinterfaces:
AnnotatedElement
,AnnotationMetadata
,AnnotationMetadataDelegate
,AnnotationMetadataProvider
,AnnotationSource
,Described
,MutableAnnotationMetadataDelegate<Element>
,Named
- All Known Subinterfaces:
AnnotationElement
,ArrayableClassElement
,BeanConstructorElement
,BeanElement
,BeanElementBuilder
,BeanFieldElement
,BeanMethodElement
,BeanParameterElement
,ClassElement
,ConfigurableElement
,ConstructorElement
,EnumConstantElement
,EnumElement
,FieldElement
,GenericElement
,GenericPlaceholderElement
,InjectableElement
,KotlinParameterElement
,MemberElement
,MethodElement
,PackageElement
,ParameterElement
,PropertyElement
,TypedElement
,WildcardElement
- All Known Implementing Classes:
AbstractAnnotationElement
,AbstractBeanDefinitionBuilder
,AbstractGroovyElement
,AbstractJavaElement
,BeanDefinitionWriter
,GroovyClassElement
,GroovyConstructorElement
,GroovyEnumConstantElement
,GroovyFieldElement
,GroovyMethodElement
,GroovyPackageElement
,GroovyParameterElement
,JavaClassElement
,JavaMethodElement
,JavaPackageElement
,PrimitiveElement
public interface Element
extends MutableAnnotationMetadataDelegate<Element>, AnnotatedElement, Described
Stores data about a compile time element. The underlying object can be a class, field, or method.
- Since:
- 1.0
- Author:
- James Kleeh, graemerocher
-
Field Summary
Fields inherited from interface io.micronaut.core.annotation.AnnotationMetadata
CLASS_NAME_SUFFIX, EMPTY_METADATA, VALUE_MEMBER
Fields inherited from interface io.micronaut.core.annotation.AnnotationSource
EMPTY
Fields inherited from interface io.micronaut.inject.ast.annotation.MutableAnnotationMetadataDelegate
EMPTY
-
Method Summary
Modifier and TypeMethodDescriptiondefault <T extends Annotation>
@NonNull Elementannotate
(@NonNull AnnotationValue<T> annotationValue) Annotate this element with the given annotation type.default <T extends Annotation>
@NonNull ElementAnnotate this element with the given annotation type.default <T extends Annotation>
@NonNull ElementAnnotate this element with the given annotation type.Annotate this element with the given annotation type.default <T extends Annotation>
@NonNull ElementAnnotate this element with the given annotation type.A description that describes this object.getDescription
(boolean simple) Allows returning a more simple description if requested.default Set<ElementModifier>
getName()
Returns the native underlying type.The simple name of the element.default boolean
default boolean
isFinal()
default boolean
default boolean
boolean
boolean
isPublic()
default boolean
isStatic()
default boolean
Checks if the current element is synthetic - not user defined but created by the compiler.default <T extends Annotation>
@NonNull ElementremoveAnnotation
(@NonNull Class<T> annotationType) removeAnnotation
(@NonNull String annotationType) Removes an annotation of the given type from the element.default <T extends Annotation>
@NonNull ElementremoveAnnotationIf
(@NonNull Predicate<AnnotationValue<T>> predicate) Removes all annotations that pass the given predicate.default <T extends Annotation>
@NonNull ElementremoveStereotype
(@NonNull Class<T> annotationType) Removes a stereotype annotation of the given type from the element.removeStereotype
(@NonNull String annotationType) Removes a stereotype of the given name from the element.default Element
withAnnotationMetadata
(AnnotationMetadata annotationMetadata) Copies this element and overrides its annotations.Methods inherited from interface io.micronaut.core.annotation.AnnotatedElement
isDeclaredNonNull, isDeclaredNullable, isNonNull, isNullable
Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadata
enumValuesSet, enumValuesSet, getValues, hasDeclaredStereotype, hasEvaluatedExpressions, hasStereotypeNonRepeating, isAnnotationPresent, isDeclaredAnnotationPresent
Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadataDelegate
booleanValue, booleanValue, booleanValue, booleanValue, classValue, classValue, classValue, classValue, classValues, classValues, classValues, classValues, copyAnnotationMetadata, doubleValue, doubleValue, doubleValue, enumValue, enumValue, enumValue, enumValue, enumValues, enumValues, enumValues, enumValues, findAnnotation, findAnnotation, findDeclaredAnnotation, findDeclaredAnnotation, findRepeatableAnnotation, findRepeatableAnnotation, getAnnotation, getAnnotation, getAnnotationNameByStereotype, getAnnotationNameByStereotype, getAnnotationNames, getAnnotationNamesByStereotype, getAnnotationNamesByStereotype, getAnnotationType, getAnnotationType, getAnnotationTypeByStereotype, getAnnotationTypeByStereotype, getAnnotationTypesByStereotype, getAnnotationTypesByStereotype, getAnnotationTypesByStereotype, getAnnotationValuesByName, getAnnotationValuesByStereotype, getAnnotationValuesByType, getDeclaredAnnotation, getDeclaredAnnotation, getDeclaredAnnotationNameByStereotype, getDeclaredAnnotationNames, getDeclaredAnnotationNamesByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationValuesByName, getDeclaredAnnotationValuesByType, getDeclaredMetadata, getDeclaredStereotypeAnnotationNames, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValues, getStereotypeAnnotationNames, getTargetAnnotationMetadata, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValues, getValues, hasAnnotation, hasAnnotation, hasDeclaredAnnotation, hasDeclaredAnnotation, hasDeclaredStereotype, hasDeclaredStereotype, hasDeclaredStereotype, hasPropertyExpressions, hasSimpleAnnotation, hasSimpleDeclaredAnnotation, hasStereotype, hasStereotype, hasStereotype, hasStereotype, intValue, intValue, intValue, isAnnotationPresent, isDeclaredAnnotationPresent, isEmpty, isFalse, isFalse, isPresent, isPresent, isRepeatableAnnotation, isRepeatableAnnotation, isTrue, isTrue, longValue, longValue, stringValue, stringValue, stringValue, stringValue, stringValues, stringValues, stringValues, stringValues, synthesize, synthesize, synthesizeAll, synthesizeAnnotationsByType, synthesizeDeclared, synthesizeDeclared, synthesizeDeclared, synthesizeDeclaredAnnotationsByType
Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadataProvider
getAnnotationMetadata
-
Field Details
-
EMPTY_ELEMENT_ARRAY
An empty array of elements.- Since:
- 2.1.1
-
-
Method Details
-
getName
-
isPackagePrivate
default boolean isPackagePrivate()- Returns:
- True if the element is package private.
- Since:
- 2.3.0
-
isSynthetic
default boolean isSynthetic()Checks if the current element is synthetic - not user defined but created by the compiler.- Returns:
- True if the element is synthetic.
- Since:
- 4.0.0
-
isProtected
boolean isProtected()- Returns:
- True if the element is protected.
-
isPublic
boolean isPublic()- Returns:
- True if the element is public.
-
getNativeType
Returns the native underlying type. This API is extended by all inject language implementations. The object returned by this method will be the language native type the information is being retrieved from.- Returns:
- The native type
-
getModifiers
- Returns:
- The
ElementModifier
types for this class element - Since:
- 3.0.0
-
getSimpleName
The simple name of the element. For a class this will be the name without the package.- Returns:
- The simple name
-
isAbstract
default boolean isAbstract()- Returns:
- True if the element is abstract.
-
isStatic
default boolean isStatic()- Returns:
- True if the element is static.
-
getDocumentation
- Returns:
- The documentation, if any.
-
isPrivate
default boolean isPrivate()- Returns:
- True if the element is private.
-
isFinal
default boolean isFinal()- Returns:
- True if the element is final.
-
getDescription
Description copied from interface:Described
A description that describes this object.- Specified by:
getDescription
in interfaceDescribed
- Returns:
- The description
-
getDescription
Description copied from interface:Described
Allows returning a more simple description if requested.- Specified by:
getDescription
in interfaceDescribed
- Parameters:
simple
- True if a simple description is required- Returns:
- The simple description
-
withAnnotationMetadata
Copies this element and overrides its annotations.- Parameters:
annotationMetadata
- The annotation metadata- Returns:
- A new element
- Since:
- 4.0.0
-
annotate
@NonNull default <T extends Annotation> @NonNull Element annotate(@NonNull @NonNull String annotationType, @NonNull @NonNull Consumer<AnnotationValueBuilder<T>> consumer) Description copied from interface:MutableAnnotationMetadataDelegate
Annotate this element with the given annotation type. If the annotation is already present then any values populated by the builder will be merged/overridden with the existing values.- Specified by:
annotate
in interfaceMutableAnnotationMetadataDelegate<Element>
- Type Parameters:
T
- The annotation generic type- Parameters:
annotationType
- The annotation typeconsumer
- A function that receives theAnnotationValueBuilder
- Returns:
- This element
-
removeAnnotation
Description copied from interface:MutableAnnotationMetadataDelegate
Removes an annotation of the given type from the element.If the annotation features any stereotypes these will also be removed unless there are other annotations that reference the stereotype to be removed.
In the case of repeatable annotations this method will remove all repeated annotations, effectively clearing out all declared repeated annotations of the given type.
- Specified by:
removeAnnotation
in interfaceMutableAnnotationMetadataDelegate<Element>
- Parameters:
annotationType
- The annotation type- Returns:
- This element
-
removeAnnotation
@NonNull default <T extends Annotation> @NonNull Element removeAnnotation(@NonNull @NonNull Class<T> annotationType) - Specified by:
removeAnnotation
in interfaceMutableAnnotationMetadataDelegate<Element>
- Type Parameters:
T
- The annotation generic type- Parameters:
annotationType
- The annotation type- Returns:
- This element
- See Also:
-
removeAnnotationIf
@NonNull default <T extends Annotation> @NonNull Element removeAnnotationIf(@NonNull @NonNull Predicate<AnnotationValue<T>> predicate) Description copied from interface:MutableAnnotationMetadataDelegate
Removes all annotations that pass the given predicate.- Specified by:
removeAnnotationIf
in interfaceMutableAnnotationMetadataDelegate<Element>
- Type Parameters:
T
- The annotation generic type- Parameters:
predicate
- The predicate- Returns:
- This element
-
removeStereotype
Description copied from interface:MutableAnnotationMetadataDelegate
Removes a stereotype of the given name from the element.- Specified by:
removeStereotype
in interfaceMutableAnnotationMetadataDelegate<Element>
- Parameters:
annotationType
- The annotation type- Returns:
- This element
-
removeStereotype
@NonNull default <T extends Annotation> @NonNull Element removeStereotype(@NonNull @NonNull Class<T> annotationType) Description copied from interface:MutableAnnotationMetadataDelegate
Removes a stereotype annotation of the given type from the element.- Specified by:
removeStereotype
in interfaceMutableAnnotationMetadataDelegate<Element>
- Type Parameters:
T
- The annotation generic type- Parameters:
annotationType
- The annotation type- Returns:
- This element
-
annotate
Description copied from interface:MutableAnnotationMetadataDelegate
Annotate this element with the given annotation type. If the annotation is already present then any values populated by the builder will be merged/overridden with the existing values.- Specified by:
annotate
in interfaceMutableAnnotationMetadataDelegate<Element>
- Parameters:
annotationType
- The annotation type- Returns:
- This element
-
annotate
@NonNull default <T extends Annotation> @NonNull Element annotate(@NonNull @NonNull Class<T> annotationType, @NonNull @NonNull Consumer<AnnotationValueBuilder<T>> consumer) Description copied from interface:MutableAnnotationMetadataDelegate
Annotate this element with the given annotation type. If the annotation is already present then any values populated by the builder will be merged/overridden with the existing values.- Specified by:
annotate
in interfaceMutableAnnotationMetadataDelegate<Element>
- Type Parameters:
T
- The annotation generic type- Parameters:
annotationType
- The annotation typeconsumer
- A function that receives theAnnotationValueBuilder
- Returns:
- This element
-
annotate
@NonNull default <T extends Annotation> @NonNull Element annotate(@NonNull @NonNull Class<T> annotationType) Description copied from interface:MutableAnnotationMetadataDelegate
Annotate this element with the given annotation type. If the annotation is already present then any values populated by the builder will be merged/overridden with the existing values.- Specified by:
annotate
in interfaceMutableAnnotationMetadataDelegate<Element>
- Type Parameters:
T
- The annotation generic type- Parameters:
annotationType
- The annotation type- Returns:
- This element
-
annotate
@NonNull default <T extends Annotation> @NonNull Element annotate(@NonNull @NonNull AnnotationValue<T> annotationValue) Description copied from interface:MutableAnnotationMetadataDelegate
Annotate this element with the given annotation type. If the annotation is already present then any values populated by the builder will be merged/overridden with the existing values.- Specified by:
annotate
in interfaceMutableAnnotationMetadataDelegate<Element>
- Type Parameters:
T
- The annotation generic type- Parameters:
annotationValue
- The annotation type- Returns:
- This element
-