Class JavaClassElement

java.lang.Object
io.micronaut.inject.ast.annotation.AbstractAnnotationElement
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.annotation.MutableAnnotationMetadataDelegate<io.micronaut.inject.ast.Element>, io.micronaut.inject.ast.ArrayableClassElement, io.micronaut.inject.ast.ClassElement, io.micronaut.inject.ast.Element, io.micronaut.inject.ast.TypedElement

@Internal public class JavaClassElement extends AbstractTypeAwareJavaElement implements io.micronaut.inject.ast.ArrayableClassElement
A class element returning data from a TypeElement.
Since:
1.0
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final int
     
    protected final TypeElement
     
    protected @Nullable String
     

    Fields inherited from class io.micronaut.annotation.processing.visitor.AbstractJavaElement

    visitorContext

    Fields inherited from class io.micronaut.inject.ast.annotation.AbstractAnnotationElement

    elementAnnotationMetadataFactory, presetAnnotationMetadata

    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.ClassElement

    ZERO_CLASS_ELEMENTS

    Fields inherited from interface io.micronaut.inject.ast.Element

    EMPTY_ELEMENT_ARRAY

    Fields inherited from interface io.micronaut.inject.ast.annotation.MutableAnnotationMetadataDelegate

    EMPTY
  • Constructor Summary

    Constructors
    Constructor
    Description
    JavaClassElement(JavaNativeElement.Class nativeType, io.micronaut.inject.ast.annotation.ElementAnnotationMetadataFactory annotationMetadataFactory, JavaVisitorContext visitorContext)
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
    @NonNull List<io.micronaut.inject.ast.MethodElement>
     
    @NonNull Map<String,Map<String,io.micronaut.inject.ast.ClassElement>>
     
    @NonNull io.micronaut.core.annotation.AnnotationMetadata
     
    protected io.micronaut.inject.ast.annotation.MutableAnnotationMetadataDelegate<?>
     
    int
     
    @NonNull List<io.micronaut.inject.ast.PropertyElement>
     
    @NonNull List<io.micronaut.inject.ast.PropertyElement>
    getBeanProperties(@NonNull io.micronaut.inject.ast.PropertyElementQuery propertyElementQuery)
     
    @NonNull List<io.micronaut.inject.ast.ClassElement>
     
     
    @NonNull List<? extends io.micronaut.inject.ast.GenericPlaceholderElement>
     
     
    <T extends io.micronaut.inject.ast.Element>
    @NonNull List<T>
    getEnclosedElements(@NonNull io.micronaut.inject.ast.ElementQuery<T> query)
     
    Optional<io.micronaut.inject.ast.ClassElement>
     
    Collection<io.micronaut.inject.ast.ClassElement>
     
    @NonNull String
     
     
    Optional<io.micronaut.inject.ast.ClassElement>
     
    io.micronaut.inject.ast.PackageElement
     
     
    @NonNull Optional<io.micronaut.inject.ast.MethodElement>
     
    @NonNull io.micronaut.inject.ast.ClassElement
     
    @NonNull String
     
    final <T extends io.micronaut.inject.ast.Element>
    List<T>
    getSourceEnclosedElements(@NonNull io.micronaut.inject.ast.ElementQuery<T> query)
    This method will produce the elements just like getEnclosedElements(ElementQuery) but the elements are constructed as the source ones.
    Optional<io.micronaut.inject.ast.ClassElement>
     
    @NonNull io.micronaut.inject.ast.ClassElement
     
    @NonNull io.micronaut.inject.ast.annotation.MutableAnnotationMetadataDelegate<io.micronaut.core.annotation.AnnotationMetadata>
    Retrieves the metadata of annotations associated with the type of the current element.
    @NonNull Map<String,io.micronaut.inject.ast.ClassElement>
     
    protected boolean
    Checks if the element is explicitly marked as null-marked.
    boolean
    hasUnresolvedTypes(io.micronaut.inject.ast.UnresolvedTypeKind... kind)
     
    boolean
     
    boolean
     
    boolean
    isAssignable(io.micronaut.inject.ast.ClassElement type)
     
    boolean
     
    boolean
     
    boolean
     
    boolean
     
    boolean
     
    boolean
     
     
    io.micronaut.inject.ast.ClassElement
    withAnnotationMetadata(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata)
     
    io.micronaut.inject.ast.ClassElement
    withArrayDimensions(int arrayDimensions)
     
    @NonNull io.micronaut.inject.ast.ClassElement
    withTypeArguments(@NonNull Collection<io.micronaut.inject.ast.ClassElement> typeArguments)
     
    @NonNull io.micronaut.inject.ast.ClassElement
    withTypeArguments(Map<String,io.micronaut.inject.ast.ClassElement> newTypeArguments)
     

    Methods inherited from class io.micronaut.annotation.processing.visitor.AbstractTypeAwareJavaElement

    canBeMarkedWithNonNull, isDeclaredNonNull, isDeclaredNullable, isNonNull, isNullable

    Methods inherited from class io.micronaut.inject.ast.annotation.AbstractAnnotationElement

    annotate, annotate, annotate, annotate, annotate, getElementAnnotationMetadata, getElementAnnotationMetadataFactory, removeAnnotation, removeAnnotation, removeAnnotationIf, removeStereotype, removeStereotype

    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

    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.inject.ast.ArrayableClassElement

    fromArray, toArray

    Methods inherited from interface io.micronaut.inject.ast.ClassElement

    addAssociatedBean, findDefaultStaticCreator, findField, findMethod, findStaticCreator, foldBoundGenericTypes, getAccessibleConstructors, getDefaultConstructor, getEnclosedElement, getFields, getFirstTypeArgument, getMethods, getSyntheticBeanProperties, getTypeArguments, getTypeArguments, isAssignable, isContainerType, isEnum, isGenericPlaceholder, isIterable, isOptional, isProxy, isRawType, isWildcard, withBoundGenericTypes

    Methods inherited from interface io.micronaut.inject.ast.Element

    annotate, annotate, annotate, annotate, annotate, getDescription, getDescription, getModifiers, isFinal, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic, isSynthetic, removeAnnotation, removeAnnotation, removeAnnotationIf, removeStereotype, removeStereotype

    Methods inherited from interface io.micronaut.inject.ast.TypedElement

    getGenericType, isVoid
  • Field Details

    • classElement

      protected final TypeElement classElement
    • arrayDimensions

      protected final int arrayDimensions
    • doc

      @Nullable protected @Nullable String doc
  • Constructor Details

    • JavaClassElement

      @Internal public JavaClassElement(JavaNativeElement.Class nativeType, io.micronaut.inject.ast.annotation.ElementAnnotationMetadataFactory annotationMetadataFactory, JavaVisitorContext visitorContext)
      Parameters:
      nativeType - The native type
      annotationMetadataFactory - The annotation metadata factory
      visitorContext - The visitor context
  • Method Details

    • getDocumentation

      public Optional<String> getDocumentation()
      Specified by:
      getDocumentation in interface io.micronaut.inject.ast.Element
      Overrides:
      getDocumentation in class AbstractJavaElement
    • getCanonicalName

      public String getCanonicalName()
      Specified by:
      getCanonicalName in interface io.micronaut.inject.ast.ClassElement
    • hasUnresolvedTypes

      public boolean hasUnresolvedTypes(io.micronaut.inject.ast.UnresolvedTypeKind... kind)
      Specified by:
      hasUnresolvedTypes in interface io.micronaut.inject.ast.ClassElement
    • getNativeType

      public @NonNull JavaNativeElement.Class getNativeType()
      Specified by:
      getNativeType in interface io.micronaut.inject.ast.Element
      Overrides:
      getNativeType in class AbstractJavaElement
    • copyThis

      protected JavaClassElement copyThis()
      Specified by:
      copyThis in class AbstractJavaElement
      Returns:
      copy of this element
    • withTypeArguments

      @NonNull public @NonNull io.micronaut.inject.ast.ClassElement withTypeArguments(Map<String,io.micronaut.inject.ast.ClassElement> newTypeArguments)
      Specified by:
      withTypeArguments in interface io.micronaut.inject.ast.ClassElement
    • withAnnotationMetadata

      public io.micronaut.inject.ast.ClassElement withAnnotationMetadata(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata)
      Specified by:
      withAnnotationMetadata in interface io.micronaut.inject.ast.ClassElement
      Specified by:
      withAnnotationMetadata in interface io.micronaut.inject.ast.Element
      Overrides:
      withAnnotationMetadata in class AbstractJavaElement
    • getAnnotationMetadataToWrite

      protected io.micronaut.inject.ast.annotation.MutableAnnotationMetadataDelegate<?> getAnnotationMetadataToWrite()
      Overrides:
      getAnnotationMetadataToWrite in class io.micronaut.inject.ast.annotation.AbstractAnnotationElement
    • getAnnotationMetadata

      @NonNull public @NonNull io.micronaut.core.annotation.AnnotationMetadata getAnnotationMetadata()
      Specified by:
      getAnnotationMetadata in interface io.micronaut.core.annotation.AnnotationMetadataProvider
      Overrides:
      getAnnotationMetadata in class io.micronaut.inject.ast.annotation.AbstractAnnotationElement
    • hasNullMarked

      protected boolean hasNullMarked()
      Description copied from class: AbstractTypeAwareJavaElement
      Checks if the element is explicitly marked as null-marked.
      Specified by:
      hasNullMarked in class AbstractTypeAwareJavaElement
      Returns:
      true if the element is marked as null-marked, false otherwise
    • getTypeAnnotationMetadata

      @NonNull public @NonNull io.micronaut.inject.ast.annotation.MutableAnnotationMetadataDelegate<io.micronaut.core.annotation.AnnotationMetadata> getTypeAnnotationMetadata()
      Description copied from class: AbstractTypeAwareJavaElement
      Retrieves the metadata of annotations associated with the type of the current element.
      Specified by:
      getTypeAnnotationMetadata in interface io.micronaut.inject.ast.ClassElement
      Specified by:
      getTypeAnnotationMetadata in class AbstractTypeAwareJavaElement
      Returns:
      the AnnotationMetadata representing the annotations of the type.
    • isTypeVariable

      public boolean isTypeVariable()
      Specified by:
      isTypeVariable in interface io.micronaut.inject.ast.ClassElement
    • toString

      public String toString()
      Overrides:
      toString in class AbstractJavaElement
    • isInner

      public boolean isInner()
      Specified by:
      isInner in interface io.micronaut.inject.ast.ClassElement
    • isRecord

      public boolean isRecord()
      Specified by:
      isRecord in interface io.micronaut.inject.ast.ClassElement
    • isPrimitive

      public boolean isPrimitive()
      Specified by:
      isPrimitive in interface io.micronaut.inject.ast.TypedElement
    • getInterfaces

      public Collection<io.micronaut.inject.ast.ClassElement> getInterfaces()
      Specified by:
      getInterfaces in interface io.micronaut.inject.ast.ClassElement
    • getSuperType

      public Optional<io.micronaut.inject.ast.ClassElement> getSuperType()
      Specified by:
      getSuperType in interface io.micronaut.inject.ast.ClassElement
    • isAbstract

      public boolean isAbstract()
      Specified by:
      isAbstract in interface io.micronaut.inject.ast.Element
      Overrides:
      isAbstract in class AbstractJavaElement
    • isInterface

      public boolean isInterface()
      Specified by:
      isInterface in interface io.micronaut.inject.ast.ClassElement
    • getBeanProperties

      @NonNull public @NonNull List<io.micronaut.inject.ast.PropertyElement> getBeanProperties()
      Specified by:
      getBeanProperties in interface io.micronaut.inject.ast.ClassElement
    • getBeanProperties

      @NonNull public @NonNull List<io.micronaut.inject.ast.PropertyElement> getBeanProperties(@NonNull @NonNull io.micronaut.inject.ast.PropertyElementQuery propertyElementQuery)
      Specified by:
      getBeanProperties in interface io.micronaut.inject.ast.ClassElement
    • getEnclosedElements

      @NonNull public <T extends io.micronaut.inject.ast.Element> @NonNull List<T> getEnclosedElements(@NonNull @NonNull io.micronaut.inject.ast.ElementQuery<T> query)
      Specified by:
      getEnclosedElements in interface io.micronaut.inject.ast.ClassElement
    • getSourceEnclosedElements

      public final <T extends io.micronaut.inject.ast.Element> List<T> getSourceEnclosedElements(@NonNull @NonNull io.micronaut.inject.ast.ElementQuery<T> query)
      This method will produce the elements just like getEnclosedElements(ElementQuery) but the elements are constructed as the source ones. ElementFactory.newSourceMethodElement(ClassElement, Object, ElementAnnotationMetadataFactory).
      Type Parameters:
      T - The element type
      Parameters:
      query - The query
      Returns:
      The list of elements
    • isArray

      public boolean isArray()
      Specified by:
      isArray in interface io.micronaut.inject.ast.TypedElement
    • getArrayDimensions

      public int getArrayDimensions()
      Specified by:
      getArrayDimensions in interface io.micronaut.inject.ast.TypedElement
    • withArrayDimensions

      public io.micronaut.inject.ast.ClassElement withArrayDimensions(int arrayDimensions)
      Specified by:
      withArrayDimensions in interface io.micronaut.inject.ast.ArrayableClassElement
    • getSimpleName

      @NonNull public @NonNull String getSimpleName()
      Specified by:
      getSimpleName in interface io.micronaut.inject.ast.ClassElement
      Specified by:
      getSimpleName in interface io.micronaut.inject.ast.Element
    • getName

      @NonNull public @NonNull String getName()
      Specified by:
      getName in interface io.micronaut.inject.ast.Element
      Specified by:
      getName in interface io.micronaut.core.naming.Named
      Overrides:
      getName in class AbstractJavaElement
    • getPackageName

      public String getPackageName()
      Specified by:
      getPackageName in interface io.micronaut.inject.ast.ClassElement
    • getPackage

      public io.micronaut.inject.ast.PackageElement getPackage()
      Specified by:
      getPackage in interface io.micronaut.inject.ast.ClassElement
    • isAssignable

      public boolean isAssignable(String type)
      Specified by:
      isAssignable in interface io.micronaut.inject.ast.ClassElement
    • isAssignable

      public boolean isAssignable(io.micronaut.inject.ast.ClassElement type)
      Specified by:
      isAssignable in interface io.micronaut.inject.ast.ClassElement
    • getOptionalValueType

      public Optional<io.micronaut.inject.ast.ClassElement> getOptionalValueType()
      Specified by:
      getOptionalValueType in interface io.micronaut.inject.ast.ClassElement
    • getPrimaryConstructor

      @NonNull public @NonNull Optional<io.micronaut.inject.ast.MethodElement> getPrimaryConstructor()
      Specified by:
      getPrimaryConstructor in interface io.micronaut.inject.ast.ClassElement
    • getAccessibleStaticCreators

      @NonNull public @NonNull List<io.micronaut.inject.ast.MethodElement> getAccessibleStaticCreators()
      Specified by:
      getAccessibleStaticCreators in interface io.micronaut.inject.ast.ClassElement
    • getEnclosingType

      public Optional<io.micronaut.inject.ast.ClassElement> getEnclosingType()
      Specified by:
      getEnclosingType in interface io.micronaut.inject.ast.ClassElement
    • getBoundGenericTypes

      @NonNull public @NonNull List<io.micronaut.inject.ast.ClassElement> getBoundGenericTypes()
      Specified by:
      getBoundGenericTypes in interface io.micronaut.inject.ast.ClassElement
    • getDeclaredGenericPlaceholders

      @NonNull public @NonNull List<? extends io.micronaut.inject.ast.GenericPlaceholderElement> getDeclaredGenericPlaceholders()
      Specified by:
      getDeclaredGenericPlaceholders in interface io.micronaut.inject.ast.ClassElement
    • getRawClassElement

      @NonNull public @NonNull io.micronaut.inject.ast.ClassElement getRawClassElement()
      Specified by:
      getRawClassElement in interface io.micronaut.inject.ast.ClassElement
    • withTypeArguments

      @NonNull public @NonNull io.micronaut.inject.ast.ClassElement withTypeArguments(@NonNull @NonNull Collection<io.micronaut.inject.ast.ClassElement> typeArguments)
      Specified by:
      withTypeArguments in interface io.micronaut.inject.ast.ClassElement
    • getTypeArguments

      @NonNull public @NonNull Map<String,io.micronaut.inject.ast.ClassElement> getTypeArguments()
      Specified by:
      getTypeArguments in interface io.micronaut.inject.ast.ClassElement
    • getAllTypeArguments

      @NonNull public @NonNull Map<String,Map<String,io.micronaut.inject.ast.ClassElement>> getAllTypeArguments()
      Specified by:
      getAllTypeArguments in interface io.micronaut.inject.ast.ClassElement
    • getType

      @NonNull public @NonNull io.micronaut.inject.ast.ClassElement getType()
      Specified by:
      getType in interface io.micronaut.inject.ast.ClassElement
      Specified by:
      getType in interface io.micronaut.inject.ast.TypedElement