Interface Element

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static Element[] EMPTY_ELEMENT_ARRAY
      An empty array of elements.
      • 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
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default <T extends java.lang.annotation.Annotation>
      Element
      annotate​(io.micronaut.core.annotation.AnnotationValue<T> annotationValue)
      Annotate this element with the given annotation type.
      default <T extends java.lang.annotation.Annotation>
      Element
      annotate​(java.lang.Class<T> annotationType)
      Annotate this element with the given annotation type.
      default <T extends java.lang.annotation.Annotation>
      Element
      annotate​(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>
      Element
      annotate​(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>
      Element
      removeAnnotation​(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>
      Element
      removeAnnotationIf​(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>
      Element
      removeStereotype​(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
      • Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadataProvider

        getAnnotationMetadata
    • 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 interface io.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
      • 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 type
        consumer - A function that receives the AnnotationValueBuilder
        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 type
        consumer - A function that receives the AnnotationValueBuilder
        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 interface io.micronaut.core.naming.Described
      • getDescription

        @NonNull
        default java.lang.String getDescription​(boolean simple)
        Specified by:
        getDescription in interface io.micronaut.core.naming.Described