Package io.micronaut.inject.ast
Interface Element
-
- All Superinterfaces:
io.micronaut.core.annotation.AnnotatedElement
,io.micronaut.core.annotation.AnnotationMetadata
,io.micronaut.core.annotation.AnnotationMetadataDelegate
,io.micronaut.core.annotation.AnnotationMetadataProvider
,io.micronaut.core.annotation.AnnotationSource
,io.micronaut.core.naming.Described
,io.micronaut.core.naming.Named
- All Known Subinterfaces:
AnnotationElement
,ArrayableClassElement
,BeanConstructorElement
,BeanElement
,BeanElementBuilder
,BeanFieldElement
,BeanMethodElement
,BeanParameterElement
,ClassElement
,ConfigurableElement
,ConstructorElement
,EnumConstantElement
,EnumElement
,FieldElement
,GenericPlaceholderElement
,InjectableElement
,MemberElement
,MethodElement
,PackageElement
,ParameterElement
,PropertyElement
,TypedElement
,WildcardElement
- All Known Implementing Classes:
AbstractBeanDefinitionBuilder
,BeanDefinitionWriter
,PrimitiveElement
public interface Element extends io.micronaut.core.annotation.AnnotationMetadataDelegate, io.micronaut.core.annotation.AnnotatedElement, io.micronaut.core.naming.Described
Stores data about a compile time element. The underlying object can be a class, field, or method.- Since:
- 1.0
-
-
Field Summary
Fields Modifier and Type Field Description static Element[]
EMPTY_ELEMENT_ARRAY
An empty array of elements.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default <T extends java.lang.annotation.Annotation>
Elementannotate(io.micronaut.core.annotation.AnnotationValue<T> annotationValue)
Annotate this element with the given annotation type.default <T extends java.lang.annotation.Annotation>
Elementannotate(java.lang.Class<T> annotationType)
Annotate this element with the given annotation type.default <T extends java.lang.annotation.Annotation>
Elementannotate(java.lang.Class<T> annotationType, java.util.function.Consumer<io.micronaut.core.annotation.AnnotationValueBuilder<T>> consumer)
Annotate this element with the given annotation type.default Element
annotate(java.lang.String annotationType)
Annotate this element with the given annotation type.default <T extends java.lang.annotation.Annotation>
Elementannotate(java.lang.String annotationType, java.util.function.Consumer<io.micronaut.core.annotation.AnnotationValueBuilder<T>> consumer)
Annotate this element with the given annotation type.default java.lang.String
getDescription()
default java.lang.String
getDescription(boolean simple)
default java.util.Optional<java.lang.String>
getDocumentation()
default java.util.Set<ElementModifier>
getModifiers()
java.lang.String
getName()
java.lang.Object
getNativeType()
Returns the native underlying type.default java.lang.String
getSimpleName()
The simple name of the element.default boolean
isAbstract()
default boolean
isFinal()
default boolean
isPackagePrivate()
default boolean
isPrivate()
boolean
isProtected()
boolean
isPublic()
default boolean
isStatic()
default <T extends java.lang.annotation.Annotation>
ElementremoveAnnotation(java.lang.Class<T> annotationType)
default Element
removeAnnotation(java.lang.String annotationType)
Removes an annotation of the given type from the element.default <T extends java.lang.annotation.Annotation>
ElementremoveAnnotationIf(java.util.function.Predicate<io.micronaut.core.annotation.AnnotationValue<T>> predicate)
Removes all annotations that pass the given predicate.default <T extends java.lang.annotation.Annotation>
ElementremoveStereotype(java.lang.Class<T> annotationType)
Removes a stereotype annotation of the given type from the element.default Element
removeStereotype(java.lang.String annotationType)
Removes a stereotype of the given name from the element.-
Methods inherited from interface io.micronaut.core.annotation.AnnotatedElement
isDeclaredNonNull, isDeclaredNullable, isNonNull, isNullable
-
Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadata
getAnnotationValuesByName, getAnnotationValuesByStereotype, getDeclaredAnnotationValuesByName, getValues, hasDeclaredStereotype, isAnnotationPresent, isDeclaredAnnotationPresent
-
Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadataDelegate
booleanValue, booleanValue, booleanValue, booleanValue, classValue, classValue, classValue, classValue, classValues, classValues, classValues, classValues, 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, getAnnotationValuesByType, getDeclaredAnnotation, getDeclaredAnnotation, getDeclaredAnnotationNameByStereotype, getDeclaredAnnotationNames, getDeclaredAnnotationNamesByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationValuesByType, getDeclaredMetadata, getDeclaredStereotypeAnnotationNames, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValues, getStereotypeAnnotationNames, 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
-
-
-
-
Field Detail
-
EMPTY_ELEMENT_ARRAY
static final Element[] EMPTY_ELEMENT_ARRAY
An empty array of elements.- Since:
- 2.1.1
-
-
Method Detail
-
getName
@NonNull java.lang.String getName()
- Specified by:
getName
in interfaceio.micronaut.core.naming.Named
- Returns:
- The name of the element. For a type this represents the binary name.
-
isPackagePrivate
default boolean isPackagePrivate()
- Returns:
- True if the element is package private.
- Since:
- 2.3.0
-
isProtected
boolean isProtected()
- Returns:
- True if the element is protected.
-
isPublic
boolean isPublic()
- Returns:
- True if the element is public.
-
getNativeType
@NonNull java.lang.Object getNativeType()
Returns the native underlying type. This API is extended by all of the 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
default java.util.Set<ElementModifier> getModifiers()
- Returns:
- The
ElementModifier
types for this class element - Since:
- 3.0.0
-
annotate
@NonNull default <T extends java.lang.annotation.Annotation> Element annotate(@NonNull java.lang.String annotationType, @NonNull java.util.function.Consumer<io.micronaut.core.annotation.AnnotationValueBuilder<T>> consumer)
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.- Type Parameters:
T
- The annotation generic type- Parameters:
annotationType
- The annotation typeconsumer
- A function that receives theAnnotationValueBuilder
- Returns:
- This element
-
removeAnnotation
default Element removeAnnotation(@NonNull java.lang.String annotationType)
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.
- Parameters:
annotationType
- The annotation type- Returns:
- This element
- Since:
- 3.0.0
-
removeAnnotation
default <T extends java.lang.annotation.Annotation> Element removeAnnotation(@NonNull java.lang.Class<T> annotationType)
- Type Parameters:
T
- The annotation generic type- Parameters:
annotationType
- The annotation type- Returns:
- This element
- Since:
- 3.0.0
- See Also:
removeAnnotation(String)
-
removeAnnotationIf
default <T extends java.lang.annotation.Annotation> Element removeAnnotationIf(@NonNull java.util.function.Predicate<io.micronaut.core.annotation.AnnotationValue<T>> predicate)
Removes all annotations that pass the given predicate.- Type Parameters:
T
- The annotation generic type- Parameters:
predicate
- The predicate- Returns:
- This element
- Since:
- 3.0.0
-
removeStereotype
default Element removeStereotype(@NonNull java.lang.String annotationType)
Removes a stereotype of the given name from the element.- Parameters:
annotationType
- The annotation type- Returns:
- This element
- Since:
- 3.0.0
-
removeStereotype
default <T extends java.lang.annotation.Annotation> Element removeStereotype(@NonNull java.lang.Class<T> annotationType)
Removes a stereotype annotation of the given type from the element.- Type Parameters:
T
- The annotation generic type- Parameters:
annotationType
- The annotation type- Returns:
- This element
- Since:
- 3.0.0
-
annotate
@NonNull default Element annotate(@NonNull java.lang.String annotationType)
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.- Parameters:
annotationType
- The annotation type- Returns:
- This element
-
annotate
@NonNull default <T extends java.lang.annotation.Annotation> Element annotate(@NonNull java.lang.Class<T> annotationType, @NonNull java.util.function.Consumer<io.micronaut.core.annotation.AnnotationValueBuilder<T>> consumer)
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.- 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 java.lang.annotation.Annotation> Element annotate(@NonNull java.lang.Class<T> annotationType)
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.- Type Parameters:
T
- The annotation generic type- Parameters:
annotationType
- The annotation type- Returns:
- This element
-
annotate
@NonNull default <T extends java.lang.annotation.Annotation> Element annotate(@NonNull io.micronaut.core.annotation.AnnotationValue<T> annotationValue)
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.- Type Parameters:
T
- The annotation generic type- Parameters:
annotationValue
- The annotation type- Returns:
- This element
- Since:
- 3.0.0
-
getSimpleName
@NonNull default java.lang.String 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
default java.util.Optional<java.lang.String> 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
@NonNull default java.lang.String getDescription()
- Specified by:
getDescription
in interfaceio.micronaut.core.naming.Described
-
getDescription
@NonNull default java.lang.String getDescription(boolean simple)
- Specified by:
getDescription
in interfaceio.micronaut.core.naming.Described
-
-