Class AbstractJavaElement

java.lang.Object
io.micronaut.inject.ast.annotation.AbstractAnnotationElement
io.micronaut.annotation.processing.visitor.AbstractJavaElement
All Implemented Interfaces:
ElementProvider, AnnotatedElement, AnnotationMetadata, AnnotationMetadataDelegate, AnnotationMetadataProvider, AnnotationSource, Described, Named, MutableAnnotationMetadataDelegate<Element>, Element
Direct Known Subclasses:
AbstractTypeAwareJavaElement, JavaPackageElement

@Internal public abstract class AbstractJavaElement extends AbstractAnnotationElement implements ElementProvider
An abstract class for other elements to extend from.
Since:
1.0
Author:
James Kleeh, graemerocher
  • Field Details

  • Method Details

    • element

      @Nullable public Element element()
      Specified by:
      element in interface ElementProvider
      Returns:
      The native element.
    • copyThis

      protected abstract AbstractJavaElement copyThis()
      Returns:
      copy of this element
    • copyValues

      protected void copyValues(AbstractJavaElement element)
      Parameters:
      element - the values to be copied to
    • makeCopy

      protected final AbstractJavaElement makeCopy()
    • withAnnotationMetadata

      public Element withAnnotationMetadata(AnnotationMetadata annotationMetadata)
      Description copied from interface: Element
      Copies this element and overrides its annotations.
      Specified by:
      withAnnotationMetadata in interface Element
      Parameters:
      annotationMetadata - The annotation metadata
      Returns:
      A new element
    • isPackagePrivate

      public boolean isPackagePrivate()
      Specified by:
      isPackagePrivate in interface Element
      Returns:
      True if the element is package private.
    • getName

      public String getName()
      Specified by:
      getName in interface Element
      Specified by:
      getName in interface Named
      Returns:
      The name of the element. For a type this represents the binary name.
    • getModifiers

      public Set<ElementModifier> getModifiers()
      Specified by:
      getModifiers in interface Element
      Returns:
      The ElementModifier types for this class element
    • getDocumentation

      public Optional<String> getDocumentation(boolean parse)
      Specified by:
      getDocumentation in interface Element
      Parameters:
      parse - True if the content should be parsed to extract documentation
      Returns:
      The documentation, if any.
    • isAbstract

      public boolean isAbstract()
      Specified by:
      isAbstract in interface Element
      Returns:
      True if the element is abstract.
    • isStatic

      public boolean isStatic()
      Specified by:
      isStatic in interface Element
      Returns:
      True if the element is static.
    • isPublic

      public boolean isPublic()
      Specified by:
      isPublic in interface Element
      Returns:
      True if the element is public.
    • isPrivate

      public boolean isPrivate()
      Specified by:
      isPrivate in interface Element
      Returns:
      True if the element is private.
    • isFinal

      public boolean isFinal()
      Specified by:
      isFinal in interface Element
      Returns:
      True if the element is final.
    • isProtected

      public boolean isProtected()
      Specified by:
      isProtected in interface Element
      Returns:
      True if the element is protected.
    • getNativeType

      public JavaNativeElement getNativeType()
      Description copied from interface: Element
      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.
      Specified by:
      getNativeType in interface Element
      Returns:
      The native type
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • newClassElement

      protected final ClassElement newClassElement(@Nullable JavaNativeElement owner, TypeMirror type, Map<String, ClassElement> declaredElementTypeArguments)
      Obtain the ClassElement for the given mirror.
      Parameters:
      owner - The owner
      type - The type
      declaredElementTypeArguments - The type arguments of the declaring element (method, class)
      Returns:
      The class element
    • newClassElement

      protected final ClassElement newClassElement(@Nullable JavaNativeElement owner, TypeMirror type, Map<String, ClassElement> declaredElementTypeArguments, @Nullable String doc)
      Obtain the ClassElement for the given mirror.
      Parameters:
      owner - The owner
      type - The type
      declaredElementTypeArguments - The type arguments of the declaring element (method, class)
      doc - The optional documentation
      Returns:
      The class element
    • newClassElement

      protected final ClassElement newClassElement(TypeMirror type, Map<String, ClassElement> declaredElementTypeArguments)
      Obtain the ClassElement for the given mirror.
      Parameters:
      type - The type
      declaredElementTypeArguments - The type arguments of the declaring element (method, class)
      Returns:
      The class element
    • resolveTypeArguments

      protected final Map<String, ClassElement> resolveTypeArguments(TypeElement typeElement, @Nullable List<? extends TypeMirror> typeMirrorArguments)
    • resolveTypeArguments

      protected final Map<String, ClassElement> resolveTypeArguments(ExecutableElement executableElement, Map<String, ClassElement> parentTypeArguments)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object