Class AbstractPythonClassElement

java.lang.Object
io.micronaut.inject.ast.annotation.AbstractAnnotationElement
io.micronaut.python.processing.visitor.AbstractPythonClassElement
All Implemented Interfaces:
ElementProvider, AnnotatedElement, AnnotationMetadata, AnnotationMetadataDelegate, AnnotationMetadataProvider, AnnotationSource, Described, Named, MutableAnnotationMetadataDelegate<Element>, ArrayableClassElement, ClassElement, Element, TypedElement
Direct Known Subclasses:
PythonClassElement, PythonEnumElement, PythonGenericPlaceholderElement

public abstract sealed class AbstractPythonClassElement extends AbstractAnnotationElement implements ArrayableClassElement, ElementProvider permits PythonClassElement, PythonEnumElement, PythonGenericPlaceholderElement
Base class element implementation shared by Python class-like elements.
  • Field Details

  • Constructor Details

  • Method Details

    • copyValues

      protected void copyValues(io.micronaut.python.processing.visitor.AbstractPythonElement element)
      Parameters:
      element - the values to be copied to
    • getAnnotationMetadataToWrite

      protected MutableAnnotationMetadataDelegate<?> getAnnotationMetadataToWrite()
      Description copied from class: AbstractAnnotationElement
      Get annotation metadata to add or remove annotations.
      Overrides:
      getAnnotationMetadataToWrite in class AbstractAnnotationElement
      Returns:
      The annotation metadata to write
    • getAnnotationMetadata

      public @NonNull AnnotationMetadata getAnnotationMetadata()
      Description copied from interface: AnnotationMetadataProvider
      Supplies the metadata. Defaults to AnnotationMetadata.EMPTY_METADATA.
      Specified by:
      getAnnotationMetadata in interface AnnotationMetadataProvider
      Overrides:
      getAnnotationMetadata in class AbstractAnnotationElement
      Returns:
      The AnnotationMetadata
    • getTypeAnnotationMetadata

      public @NonNull MutableAnnotationMetadataDelegate<AnnotationMetadata> getTypeAnnotationMetadata()
      Description copied from interface: ClassElement
      Returns the type annotations. Added by: - The declaration of the type variable ElementType.TYPE_PARAMETER - The use of the type ElementType.TYPE
      Specified by:
      getTypeAnnotationMetadata in interface ClassElement
      Returns:
      the type annotations
    • getTypeAnnotationsKey

      public final ElementDef getTypeAnnotationsKey()
    • findPythonClass

      @Nullable protected final @Nullable ClassElement findPythonClass(TypeRef typeRef)
    • excludeIntrospectedProperties

      protected final void excludeIntrospectedProperties(String... propertyNames)
    • isAbstract

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

      public Collection<ClassElement> getInterfaces()
      Specified by:
      getInterfaces in interface ClassElement
      Returns:
      The interfaces implemented by this class element
    • element

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

      public ClassElement withArrayDimensions(int arrayDimensions)
      Description copied from interface: ArrayableClassElement
      Convert the class element to an element for the same type, but with the given number of array dimensions. Do not mutate the existing instance. Create a new instance instead.
      Specified by:
      withArrayDimensions in interface ArrayableClassElement
      Parameters:
      arrayDimensions - The number of array dimensions of the new class element
      Returns:
      A new class element
    • createWithArrayDimensions

      protected abstract ClassElement createWithArrayDimensions(int arrayDimensions)
    • isArray

      public boolean isArray()
      Description copied from interface: TypedElement
      Is the type an array.
      Specified by:
      isArray in interface TypedElement
      Returns:
      True if it is.
    • getArrayDimensions

      public int getArrayDimensions()
      Description copied from interface: TypedElement
      If the type is an array, the number of dimensions. String[] should return 1, String[][] should return 2
      Specified by:
      getArrayDimensions in interface TypedElement
      Returns:
      The number of dimensions
    • getEnclosedElements

      public <T extends Element> List<T> getEnclosedElements(ElementQuery<T> query)
      Description copied from interface: ClassElement
      Return the elements that match the given query.
      Specified by:
      getEnclosedElements in interface ClassElement
      Type Parameters:
      T - The element type
      Parameters:
      query - The query to use.
      Returns:
      The fields
    • getFields

      public List<FieldElement> getFields()
      Description copied from interface: ClassElement
      Return all the fields of this class element.
      Specified by:
      getFields in interface ClassElement
      Returns:
      The fields
    • getNativeType

      public ClassDef 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
    • getPackageName

      public String getPackageName()
      Description copied from interface: ClassElement
      The package name.
      Specified by:
      getPackageName in interface ClassElement
      Returns:
      The package name
    • getDocumentation

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

      public List<PropertyElement> getSyntheticBeanProperties()
      Description copied from interface: ClassElement
      Returns the synthetic bean properties. The properties where one of the methods (getter or setter) is synthetic - not user defined but created by the compiler.
      Specified by:
      getSyntheticBeanProperties in interface ClassElement
      Returns:
      The bean properties for this class element
    • getBeanProperties

      public List<PropertyElement> getBeanProperties()
      Description copied from interface: ClassElement
      Returns the bean properties (getters and setters) for this class element.
      Specified by:
      getBeanProperties in interface ClassElement
      Returns:
      The bean properties for this class element
    • getBeanProperties

      public List<PropertyElement> getBeanProperties(PropertyElementQuery propertyElementQuery)
      Description copied from interface: ClassElement
      Returns the bean properties (getters and setters) for this class element based on custom configuration.
      Specified by:
      getBeanProperties in interface ClassElement
      Parameters:
      propertyElementQuery - The configuration
      Returns:
      The bean properties for this class element
    • copyThis

      protected abstract io.micronaut.python.processing.visitor.AbstractPythonElement copyThis()
      Returns:
      copy of this element
    • withAnnotationMetadata

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

      protected final io.micronaut.python.processing.visitor.AbstractPythonElement makeCopy()
    • 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.
    • isProtected

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

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

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

      public int hashCode()
      Overrides:
      hashCode in class Object