Class ParseElement<E extends AnnotatedElement>

java.lang.Object
studio.mevera.imperat.annotations.base.element.ParseElement<E>
All Implemented Interfaces:
Iterable<Annotation>, AnnotatedElement
Direct Known Subclasses:
ClassElement, MethodElement, ParameterElement

public abstract sealed class ParseElement<E extends AnnotatedElement> extends Object implements AnnotatedElement, Iterable<Annotation> permits ClassElement, MethodElement, ParameterElement
  • Field Details

  • Constructor Details

    • ParseElement

      public ParseElement(@NotNull @NotNull AnnotationParser<S> parser, @Nullable @Nullable ParseElement<?> parent, @NotNull E element)
  • Method Details

    • getAnnotation

      @Nullable public <T extends Annotation> T getAnnotation(@NotNull @NotNull Class<T> annotationClass)
      Returns this element's annotation for the specified valueType if such an annotation is present, else null.
      Specified by:
      getAnnotation in interface AnnotatedElement
      Parameters:
      annotationClass - the Class object corresponding to the annotation valueType
      Returns:
      this element's annotation for the specified annotation valueType if present on this element, else null
      Throws:
      NullPointerException - if the given annotation class is null
      Since:
      1.5
    • getAnnotations

      public Annotation @NotNull [] getAnnotations()
      Returns annotations that are present on this element.

      If there are no annotations present on this element, the return value is an array of length 0.

      The caller of this method is free to modify the returned array; it will have no effect on the arrays returned to other callers.

      Specified by:
      getAnnotations in interface AnnotatedElement
      Returns:
      annotations present on this element
      Since:
      1.5
    • getDeclaredAnnotations

      public Annotation @NotNull [] getDeclaredAnnotations()
      Returns annotations that are directly present on this element. This method ignores inherited annotations.

      If there are no annotations directly present on this element, the return value is an array of length 0.

      The caller of this method is free to modify the returned array; it will have no effect on the arrays returned to other callers.

      Specified by:
      getDeclaredAnnotations in interface AnnotatedElement
      Returns:
      annotations directly present on this element
      Since:
      1.5
    • iterator

      @NotNull public @NotNull Iterator<Annotation> iterator()
      Returns an iterator over elements of valueType T.
      Specified by:
      iterator in interface Iterable<E extends AnnotatedElement>
      Returns:
      an Iterator.
    • toString

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

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

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getName

      public abstract String getName()
    • getParent

      @Nullable public @Nullable ParseElement<?> getParent()
    • getElement

      @NotNull public E getElement()