Class AnnotationSet

java.lang.Object
oracle.dbtools.plugin.api.types.AnnotationSet
All Implemented Interfaces:
Iterable<Annotation>

public class AnnotationSet extends Object implements Iterable<Annotation>
Immutable set of Annotation instances
Since:
19.3.0
Author:
cdivilly
  • Method Details

    • element

      public AnnotatedElement element()
      The element which is annotated with these Annotations
      Returns:
      AnnotatedElement instance
    • isAnnotationPresent

      public boolean isAnnotationPresent(Class<? extends Annotation> annotationClass)
      Returns true if an annotation for the specified type is present on this element, else false. This method is designed primarily for convenient access to marker annotations.

      The truth value returned by this method is equivalent to: getAnnotation(annotationClass) != null

      The body of the default method is specified to be the code above.

      Parameters:
      annotationClass - the Class object corresponding to the annotation type
      Returns:
      true if an annotation for the specified annotation type is present on this element, else false
      Throws:
      NullPointerException - if the given annotation class is null
    • getAnnotation

      public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
      Returns this element's annotation for the specified type if such an annotation is present, else null.
      Type Parameters:
      T - the type of the annotation to query for and return if present
      Parameters:
      annotationClass - the Class object corresponding to the annotation type
      Returns:
      this element's annotation for the specified annotation type if present on this element, else null
      Throws:
      NullPointerException - if the given annotation class is null
    • equals

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

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

      public boolean isEmpty()
      Indicates if this annotation set is empty
      Returns:
      true if the set is empty, false otherwise
    • iterator

      public Iterator<Annotation> iterator()
      Specified by:
      iterator in interface Iterable<Annotation>
    • qualifiers

      public Set<Annotation> qualifiers()
      Gives the subset of Annotations that represent Qualifier annotations
    • scope

      public Annotation scope()
      Indicates the Scope annotation if any is present
      Returns:
      Annotation annotated with Scope or null if no such annotation is present
    • size

      public int size()
      Indicates the number of annotations present
      Returns:
      The number of annotations in this set
    • toString

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

      public static AnnotationSet from(AnnotatedElement element)
      Generate the set of annotations that this element is annotated with
      Parameters:
      element - The element to examine
      Returns:
      AnnotationSet for the element