Class PythonAnnotationElement

All Implemented Interfaces:
ElementProvider, AnnotatedElement, AnnotationMetadata, AnnotationMetadataDelegate, AnnotationMetadataProvider, AnnotationSource, Described, Named, MutableAnnotationMetadataDelegate<Element>, AnnotationElement, ArrayableClassElement, ClassElement, Element, TypedElement

public final class PythonAnnotationElement extends PythonClassElement implements AnnotationElement
Class element implementation for Python annotations, which are declared as decorators.
Since:
5.2.0
Author:
Denis Stepanov
  • Constructor Details

    • PythonAnnotationElement

      public PythonAnnotationElement(ClassDef classDef, PythonProcessingEnvironment environment)
      Parameters:
      classDef - The class definition synthesized for the decorator
      environment - The environment
  • Method Details

    • copyThis

      protected PythonClassElement copyThis()
      Overrides:
      copyThis in class PythonClassElement
      Returns:
      copy of this element
    • isInherited

      public boolean isInherited()
      Description copied from interface: AnnotationElement
      Is the annotation annotated with Inherited?

      Meta-annotations from the java.lang.annotation package are excluded from the annotation metadata (see AnnotationUtil.STEREOTYPE_EXCLUDES), so the answer cannot be retrieved with AnnotationMetadata.hasDeclaredAnnotation(String). Implementations backed by a native element resolve it from that element instead; the default implementation, for implementations that have no native element to inspect, always returns false.

      Specified by:
      isInherited in interface AnnotationElement
      Returns:
      true if the annotation type is declared Inherited
    • makeCopy

      protected final io.micronaut.python.processing.element.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.
    • getModifiers

      public Set<ElementModifier> getModifiers()
      Python has no access modifiers, so the modifiers are derived from the visibility, static, abstract and final predicates of the element: an element is public unless its name marks it private, which keeps the modifier set consistent with Element.isPublic(), Element.isStatic(), Element.isAbstract() and Element.isFinal() for the callers that filter on modifiers, such as ElementQuery.modifiers(...) and BeanElementBuilder.produceBeans(...).
      Specified by:
      getModifiers in interface Element
      Returns:
      The modifiers
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object