Class AbstractJavaElement

  • All Implemented Interfaces:
    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, io.micronaut.inject.ast.Element
    Direct Known Subclasses:
    JavaClassElement, JavaMethodElement, JavaPackageElement

    public abstract class AbstractJavaElement
    extends java.lang.Object
    implements io.micronaut.inject.ast.Element
    An abstract class for other elements to extend from.
    Since:
    1.0
    • 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.Element

        EMPTY_ELEMENT_ARRAY
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <T extends java.lang.annotation.Annotation>
      io.micronaut.inject.ast.Element
      annotate​(io.micronaut.core.annotation.AnnotationValue<T> annotationValue)  
      <T extends java.lang.annotation.Annotation>
      io.micronaut.inject.ast.Element
      annotate​(java.lang.String annotationType, java.util.function.Consumer<io.micronaut.core.annotation.AnnotationValueBuilder<T>> consumer)  
      boolean equals​(java.lang.Object o)  
      io.micronaut.core.annotation.AnnotationMetadata getAnnotationMetadata()  
      java.util.Optional<java.lang.String> getDocumentation()  
      java.util.Set<io.micronaut.inject.ast.ElementModifier> getModifiers()  
      java.lang.String getName()  
      java.lang.Object getNativeType()  
      int hashCode()  
      boolean isAbstract()  
      boolean isFinal()  
      boolean isPackagePrivate()  
      boolean isPrivate()  
      boolean isProtected()  
      boolean isPublic()  
      boolean isStatic()  
      protected io.micronaut.inject.ast.ClassElement mirrorToClassElement​(javax.lang.model.type.TypeMirror returnType, JavaVisitorContext visitorContext)
      Obtain the ClassElement for the given mirror.
      protected io.micronaut.inject.ast.ClassElement mirrorToClassElement​(javax.lang.model.type.TypeMirror returnType, JavaVisitorContext visitorContext, java.util.Map<java.lang.String,​java.util.Map<java.lang.String,​javax.lang.model.type.TypeMirror>> genericsInfo)
      Obtain the ClassElement for the given mirror.
      protected io.micronaut.inject.ast.ClassElement mirrorToClassElement​(javax.lang.model.type.TypeMirror returnType, JavaVisitorContext visitorContext, java.util.Map<java.lang.String,​java.util.Map<java.lang.String,​javax.lang.model.type.TypeMirror>> genericsInfo, boolean includeTypeAnnotations)
      Obtain the ClassElement for the given mirror.
      protected io.micronaut.inject.ast.ClassElement mirrorToClassElement​(javax.lang.model.type.TypeMirror returnType, JavaVisitorContext visitorContext, java.util.Map<java.lang.String,​java.util.Map<java.lang.String,​javax.lang.model.type.TypeMirror>> genericsInfo, boolean includeTypeAnnotations, boolean isTypeVariable)
      Obtain the ClassElement for the given mirror.
      protected io.micronaut.inject.ast.ClassElement parameterizedClassElement​(javax.lang.model.type.TypeMirror typeMirror, JavaVisitorContext visitorContext, java.util.Map<java.lang.String,​java.util.Map<java.lang.String,​javax.lang.model.type.TypeMirror>> declaredGenericInfo)
      Returns a class element with aligned generic information.
      io.micronaut.inject.ast.Element removeAnnotation​(java.lang.String annotationType)  
      <T extends java.lang.annotation.Annotation>
      io.micronaut.inject.ast.Element
      removeAnnotationIf​(java.util.function.Predicate<io.micronaut.core.annotation.AnnotationValue<T>> predicate)  
      io.micronaut.inject.ast.Element removeStereotype​(java.lang.String annotationType)  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • 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.inject.ast.Element

        annotate, annotate, annotate, getDescription, getDescription, getSimpleName, removeAnnotation, removeStereotype
    • Method Detail

      • annotate

        @NonNull
        public <T extends java.lang.annotation.Annotation> io.micronaut.inject.ast.Element annotate​(@NonNull
                                                                                                    java.lang.String annotationType,
                                                                                                    @NonNull
                                                                                                    java.util.function.Consumer<io.micronaut.core.annotation.AnnotationValueBuilder<T>> consumer)
        Specified by:
        annotate in interface io.micronaut.inject.ast.Element
      • annotate

        public <T extends java.lang.annotation.Annotation> io.micronaut.inject.ast.Element annotate​(io.micronaut.core.annotation.AnnotationValue<T> annotationValue)
        Specified by:
        annotate in interface io.micronaut.inject.ast.Element
      • removeAnnotation

        public io.micronaut.inject.ast.Element removeAnnotation​(@NonNull
                                                                java.lang.String annotationType)
        Specified by:
        removeAnnotation in interface io.micronaut.inject.ast.Element
      • removeAnnotationIf

        public <T extends java.lang.annotation.Annotation> io.micronaut.inject.ast.Element removeAnnotationIf​(@NonNull
                                                                                                              java.util.function.Predicate<io.micronaut.core.annotation.AnnotationValue<T>> predicate)
        Specified by:
        removeAnnotationIf in interface io.micronaut.inject.ast.Element
      • removeStereotype

        public io.micronaut.inject.ast.Element removeStereotype​(@NonNull
                                                                java.lang.String annotationType)
        Specified by:
        removeStereotype in interface io.micronaut.inject.ast.Element
      • isPackagePrivate

        public boolean isPackagePrivate()
        Specified by:
        isPackagePrivate in interface io.micronaut.inject.ast.Element
      • getName

        public java.lang.String getName()
        Specified by:
        getName in interface io.micronaut.inject.ast.Element
        Specified by:
        getName in interface io.micronaut.core.naming.Named
      • getModifiers

        public java.util.Set<io.micronaut.inject.ast.ElementModifier> getModifiers()
        Specified by:
        getModifiers in interface io.micronaut.inject.ast.Element
      • getDocumentation

        public java.util.Optional<java.lang.String> getDocumentation()
        Specified by:
        getDocumentation in interface io.micronaut.inject.ast.Element
      • isAbstract

        public boolean isAbstract()
        Specified by:
        isAbstract in interface io.micronaut.inject.ast.Element
      • isStatic

        public boolean isStatic()
        Specified by:
        isStatic in interface io.micronaut.inject.ast.Element
      • isPublic

        public boolean isPublic()
        Specified by:
        isPublic in interface io.micronaut.inject.ast.Element
      • isPrivate

        public boolean isPrivate()
        Specified by:
        isPrivate in interface io.micronaut.inject.ast.Element
      • isFinal

        public boolean isFinal()
        Specified by:
        isFinal in interface io.micronaut.inject.ast.Element
      • isProtected

        public boolean isProtected()
        Specified by:
        isProtected in interface io.micronaut.inject.ast.Element
      • getNativeType

        public java.lang.Object getNativeType()
        Specified by:
        getNativeType in interface io.micronaut.inject.ast.Element
      • getAnnotationMetadata

        public io.micronaut.core.annotation.AnnotationMetadata getAnnotationMetadata()
        Specified by:
        getAnnotationMetadata in interface io.micronaut.core.annotation.AnnotationMetadataProvider
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • parameterizedClassElement

        @NonNull
        protected io.micronaut.inject.ast.ClassElement parameterizedClassElement​(javax.lang.model.type.TypeMirror typeMirror,
                                                                                 JavaVisitorContext visitorContext,
                                                                                 java.util.Map<java.lang.String,​java.util.Map<java.lang.String,​javax.lang.model.type.TypeMirror>> declaredGenericInfo)
        Returns a class element with aligned generic information.
        Parameters:
        typeMirror - The type mirror
        visitorContext - The visitor context
        declaredGenericInfo - The declared generic info
        Returns:
        The class element
      • mirrorToClassElement

        @NonNull
        protected io.micronaut.inject.ast.ClassElement mirrorToClassElement​(javax.lang.model.type.TypeMirror returnType,
                                                                            JavaVisitorContext visitorContext)
        Obtain the ClassElement for the given mirror.
        Parameters:
        returnType - The return type
        visitorContext - The visitor context
        Returns:
        The class element
      • mirrorToClassElement

        @NonNull
        protected io.micronaut.inject.ast.ClassElement mirrorToClassElement​(javax.lang.model.type.TypeMirror returnType,
                                                                            JavaVisitorContext visitorContext,
                                                                            java.util.Map<java.lang.String,​java.util.Map<java.lang.String,​javax.lang.model.type.TypeMirror>> genericsInfo)
        Obtain the ClassElement for the given mirror.
        Parameters:
        returnType - The return type
        visitorContext - The visitor context
        genericsInfo - The generic information.
        Returns:
        The class element
      • mirrorToClassElement

        @NonNull
        protected io.micronaut.inject.ast.ClassElement mirrorToClassElement​(javax.lang.model.type.TypeMirror returnType,
                                                                            JavaVisitorContext visitorContext,
                                                                            java.util.Map<java.lang.String,​java.util.Map<java.lang.String,​javax.lang.model.type.TypeMirror>> genericsInfo,
                                                                            boolean includeTypeAnnotations)
        Obtain the ClassElement for the given mirror.
        Parameters:
        returnType - The return type
        visitorContext - The visitor context
        genericsInfo - The generic information.
        includeTypeAnnotations - Whether to include type level annotations in the metadata for the element
        Returns:
        The class element
      • mirrorToClassElement

        @NonNull
        protected io.micronaut.inject.ast.ClassElement mirrorToClassElement​(javax.lang.model.type.TypeMirror returnType,
                                                                            JavaVisitorContext visitorContext,
                                                                            java.util.Map<java.lang.String,​java.util.Map<java.lang.String,​javax.lang.model.type.TypeMirror>> genericsInfo,
                                                                            boolean includeTypeAnnotations,
                                                                            boolean isTypeVariable)
        Obtain the ClassElement for the given mirror.
        Parameters:
        returnType - The return type
        visitorContext - The visitor context
        genericsInfo - The generic information.
        includeTypeAnnotations - Whether to include type level annotations in the metadata for the element
        isTypeVariable - is the type a type variable
        Returns:
        The class element
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object