Class Annotations

  • All Implemented Interfaces:
    java.lang.Iterable<Annotation>

    public class Annotations
    extends java.lang.Object
    implements java.lang.Iterable<Annotation>
    A collection of annotations.
    • Constructor Summary

      Constructors 
      Constructor Description
      Annotations​(Annotation... annotations)
      Builds a collection of annotations from an array of annotations.
      Annotations​(java.util.Collection<Annotation> annotations)
      Builds a collection of annotations from a given collection.
    • Constructor Detail

      • Annotations

        public Annotations​(Annotation... annotations)
        Builds a collection of annotations from an array of annotations.
        Parameters:
        annotations - the array of annotations
      • Annotations

        public Annotations​(java.util.Collection<Annotation> annotations)
        Builds a collection of annotations from a given collection.
        Parameters:
        annotations - the collection of annotations
    • Method Detail

      • getAnnotations

        public java.util.Collection<Annotation> getAnnotations()
        Yields the list of annotations.
        Returns:
        the list of annotations
      • iterator

        public java.util.Iterator<Annotation> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<Annotation>
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • addAnnotation

        public void addAnnotation​(Annotation ann)
        Adds an annotations to this annotation collection.
        Parameters:
        ann - the annotation to be added
      • contains

        public final boolean contains​(AnnotationMatcher m)
        Returns true if matcher matches at least one of this annotations, false otherwise.
        Parameters:
        m - the annotation matcher
        Returns:
        true if matcher matches at least one of this annotations, false otherwise
      • getAnnotations

        public final Annotations getAnnotations​(AnnotationMatcher m)
        Yields the annotations that are matched by the matcher m.
        Parameters:
        m - the annotation matcher
        Returns:
        the annotations that are matched by the matcher m
      • isEmpty

        public final boolean isEmpty()
        Yields true if and only if the set of annotations represented by this instance is empty.
        Returns:
        whether or not this set of annotations is empty