Class AnnotationMirrorSet

  • All Implemented Interfaces:
    java.lang.Iterable<javax.lang.model.element.AnnotationMirror>, java.util.Collection<javax.lang.model.element.AnnotationMirror>, java.util.NavigableSet<@KeyFor("this") javax.lang.model.element.AnnotationMirror>, java.util.Set<javax.lang.model.element.AnnotationMirror>, java.util.SortedSet<javax.lang.model.element.AnnotationMirror>, org.plumelib.util.DeepCopyable<AnnotationMirrorSet>

    public class AnnotationMirrorSet
    extends java.lang.Object
    implements java.util.NavigableSet<@KeyFor("this") javax.lang.model.element.AnnotationMirror>, org.plumelib.util.DeepCopyable<AnnotationMirrorSet>
    The Set interface defines many methods with respect to the equals method. This implementation of Set violates those specifications, but fulfills the same property using AnnotationUtils.areSame(javax.lang.model.element.AnnotationMirror, javax.lang.model.element.AnnotationMirror) rather than equals.

    For example, the specification for the contains(Object o) method says: "returns true if and only if this collection contains at least one element e such that (o == null ? e == null : o.equals(e))." The specification for contains(java.lang.Object) is "returns true if and only if this collection contains at least one element e such that (o == null ? e == null : AnnotationUtils.areSame(o, e))".

    AnnotationMirror is an interface and not all implementing classes provide a correct equals method; therefore, the existing implementations of Set cannot be used.

    • Constructor Detail

      • AnnotationMirrorSet

        public AnnotationMirrorSet()
        Default constructor.
      • AnnotationMirrorSet

        public AnnotationMirrorSet​(javax.lang.model.element.AnnotationMirror value)
        Creates a new AnnotationMirrorSet that contains value.
        Parameters:
        value - the AnnotationMirror to put in the set
      • AnnotationMirrorSet

        public AnnotationMirrorSet​(java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> annos)
        Returns a new AnnotationMirrorSet that contains the given annotation mirrors.
        Parameters:
        annos - the AnnotationMirrors to put in the set
    • Method Detail

      • makeUnmodifiable

        public AnnotationMirrorSet makeUnmodifiable()
        Make this set unmodifiable.
        Returns:
        this set
      • singleton

        public static AnnotationMirrorSet singleton​(javax.lang.model.element.AnnotationMirror value)
        Returns a new unmodifiable AnnotationMirrorSet that contains value.
        Parameters:
        value - the AnnotationMirror to put in the set
        Returns:
        a new unmodifiable AnnotationMirrorSet that contains only value
      • unmodifiableSet

        public static AnnotationMirrorSet unmodifiableSet​(java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> annos)
        Returns an unmodifiable AnnotationMirrorSet with the given elements.
        Parameters:
        annos - the annotation mirrors that will constitute the new unmodifiable set
        Returns:
        an unmodifiable AnnotationMirrorSet with the given elements
      • emptySet

        public static AnnotationMirrorSet emptySet()
        Returns an empty set.
        Returns:
        an empty set
      • size

        public int size()
        Specified by:
        size in interface java.util.Collection<javax.lang.model.element.AnnotationMirror>
        Specified by:
        size in interface java.util.Set<javax.lang.model.element.AnnotationMirror>
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface java.util.Collection<javax.lang.model.element.AnnotationMirror>
        Specified by:
        isEmpty in interface java.util.Set<javax.lang.model.element.AnnotationMirror>
      • contains

        public boolean contains​(@UnknownInitialization(AnnotationMirrorSet.class) AnnotationMirrorSet this,
                                @Nullable java.lang.Object o)
        Specified by:
        contains in interface java.util.Collection<javax.lang.model.element.AnnotationMirror>
        Specified by:
        contains in interface java.util.Set<javax.lang.model.element.AnnotationMirror>
      • iterator

        public java.util.Iterator<@KeyFor("this") javax.lang.model.element.AnnotationMirror> iterator()
        Specified by:
        iterator in interface java.util.Collection<javax.lang.model.element.AnnotationMirror>
        Specified by:
        iterator in interface java.lang.Iterable<javax.lang.model.element.AnnotationMirror>
        Specified by:
        iterator in interface java.util.NavigableSet<@KeyFor("this") javax.lang.model.element.AnnotationMirror>
        Specified by:
        iterator in interface java.util.Set<javax.lang.model.element.AnnotationMirror>
      • toArray

        public java.lang.Object[] toArray()
        Specified by:
        toArray in interface java.util.Collection<javax.lang.model.element.AnnotationMirror>
        Specified by:
        toArray in interface java.util.Set<javax.lang.model.element.AnnotationMirror>
      • toArray

        public <@KeyForBottom T> @Nullable T[] toArray​(@PolyNull T[] a)
        Specified by:
        toArray in interface java.util.Collection<javax.lang.model.element.AnnotationMirror>
        Specified by:
        toArray in interface java.util.Set<javax.lang.model.element.AnnotationMirror>
      • add

        public boolean add​(@UnknownInitialization(AnnotationMirrorSet.class) AnnotationMirrorSet this,
                           javax.lang.model.element.AnnotationMirror annotationMirror)
        Specified by:
        add in interface java.util.Collection<javax.lang.model.element.AnnotationMirror>
        Specified by:
        add in interface java.util.Set<javax.lang.model.element.AnnotationMirror>
      • remove

        public boolean remove​(@Nullable java.lang.Object o)
        Specified by:
        remove in interface java.util.Collection<javax.lang.model.element.AnnotationMirror>
        Specified by:
        remove in interface java.util.Set<javax.lang.model.element.AnnotationMirror>
      • containsAll

        public boolean containsAll​(java.util.Collection<?> c)
        Specified by:
        containsAll in interface java.util.Collection<javax.lang.model.element.AnnotationMirror>
        Specified by:
        containsAll in interface java.util.Set<javax.lang.model.element.AnnotationMirror>
      • addAll

        public boolean addAll​(@UnknownInitialization(AnnotationMirrorSet.class) AnnotationMirrorSet this,
                              java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> c)
        Specified by:
        addAll in interface java.util.Collection<javax.lang.model.element.AnnotationMirror>
        Specified by:
        addAll in interface java.util.Set<javax.lang.model.element.AnnotationMirror>
      • retainAll

        public boolean retainAll​(java.util.Collection<?> c)
        Specified by:
        retainAll in interface java.util.Collection<javax.lang.model.element.AnnotationMirror>
        Specified by:
        retainAll in interface java.util.Set<javax.lang.model.element.AnnotationMirror>
      • removeAll

        public boolean removeAll​(java.util.Collection<?> c)
        Specified by:
        removeAll in interface java.util.Collection<javax.lang.model.element.AnnotationMirror>
        Specified by:
        removeAll in interface java.util.Set<javax.lang.model.element.AnnotationMirror>
      • clear

        public void clear()
        Specified by:
        clear in interface java.util.Collection<javax.lang.model.element.AnnotationMirror>
        Specified by:
        clear in interface java.util.Set<javax.lang.model.element.AnnotationMirror>
      • toString

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

        public boolean equals​(@Nullable java.lang.Object o)
        Specified by:
        equals in interface java.util.Collection<javax.lang.model.element.AnnotationMirror>
        Specified by:
        equals in interface java.util.Set<javax.lang.model.element.AnnotationMirror>
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in interface java.util.Collection<javax.lang.model.element.AnnotationMirror>
        Specified by:
        hashCode in interface java.util.Set<javax.lang.model.element.AnnotationMirror>
        Overrides:
        hashCode in class java.lang.Object
      • comparator

        public java.util.Comparator<? super javax.lang.model.element.AnnotationMirror> comparator()
        Specified by:
        comparator in interface java.util.SortedSet<javax.lang.model.element.AnnotationMirror>
      • first

        public @KeyFor("this") javax.lang.model.element.AnnotationMirror first()
        Specified by:
        first in interface java.util.SortedSet<javax.lang.model.element.AnnotationMirror>
      • last

        public @KeyFor("this") javax.lang.model.element.AnnotationMirror last()
        Specified by:
        last in interface java.util.SortedSet<javax.lang.model.element.AnnotationMirror>
      • lower

        public @Nullable @KeyFor("this") javax.lang.model.element.AnnotationMirror lower​(javax.lang.model.element.AnnotationMirror e)
        Specified by:
        lower in interface java.util.NavigableSet<@KeyFor("this") javax.lang.model.element.AnnotationMirror>
      • floor

        public @Nullable @KeyFor("this") javax.lang.model.element.AnnotationMirror floor​(javax.lang.model.element.AnnotationMirror e)
        Specified by:
        floor in interface java.util.NavigableSet<@KeyFor("this") javax.lang.model.element.AnnotationMirror>
      • ceiling

        public @Nullable @KeyFor("this") javax.lang.model.element.AnnotationMirror ceiling​(javax.lang.model.element.AnnotationMirror e)
        Specified by:
        ceiling in interface java.util.NavigableSet<@KeyFor("this") javax.lang.model.element.AnnotationMirror>
      • higher

        public @Nullable @KeyFor("this") javax.lang.model.element.AnnotationMirror higher​(javax.lang.model.element.AnnotationMirror e)
        Specified by:
        higher in interface java.util.NavigableSet<@KeyFor("this") javax.lang.model.element.AnnotationMirror>
      • pollFirst

        public @Nullable @KeyFor("this") javax.lang.model.element.AnnotationMirror pollFirst()
        Specified by:
        pollFirst in interface java.util.NavigableSet<@KeyFor("this") javax.lang.model.element.AnnotationMirror>
      • pollLast

        public @Nullable @KeyFor("this") javax.lang.model.element.AnnotationMirror pollLast()
        Specified by:
        pollLast in interface java.util.NavigableSet<@KeyFor("this") javax.lang.model.element.AnnotationMirror>
      • descendingSet

        public AnnotationMirrorSet descendingSet()
        Specified by:
        descendingSet in interface java.util.NavigableSet<@KeyFor("this") javax.lang.model.element.AnnotationMirror>
      • descendingIterator

        public java.util.Iterator<@KeyFor("this") javax.lang.model.element.AnnotationMirror> descendingIterator()
        Specified by:
        descendingIterator in interface java.util.NavigableSet<@KeyFor("this") javax.lang.model.element.AnnotationMirror>
      • subSet

        public AnnotationMirrorSet subSet​(javax.lang.model.element.AnnotationMirror fromElement,
                                          boolean fromInclusive,
                                          javax.lang.model.element.AnnotationMirror toElement,
                                          boolean toInclusive)
        Specified by:
        subSet in interface java.util.NavigableSet<@KeyFor("this") javax.lang.model.element.AnnotationMirror>
      • headSet

        public AnnotationMirrorSet headSet​(javax.lang.model.element.AnnotationMirror toElement,
                                           boolean inclusive)
        Specified by:
        headSet in interface java.util.NavigableSet<@KeyFor("this") javax.lang.model.element.AnnotationMirror>
      • tailSet

        public AnnotationMirrorSet tailSet​(javax.lang.model.element.AnnotationMirror fromElement,
                                           boolean inclusive)
        Specified by:
        tailSet in interface java.util.NavigableSet<@KeyFor("this") javax.lang.model.element.AnnotationMirror>
      • subSet

        public AnnotationMirrorSet subSet​(javax.lang.model.element.AnnotationMirror fromElement,
                                          javax.lang.model.element.AnnotationMirror toElement)
        Specified by:
        subSet in interface java.util.NavigableSet<@KeyFor("this") javax.lang.model.element.AnnotationMirror>
        Specified by:
        subSet in interface java.util.SortedSet<javax.lang.model.element.AnnotationMirror>
      • headSet

        public AnnotationMirrorSet headSet​(javax.lang.model.element.AnnotationMirror toElement)
        Specified by:
        headSet in interface java.util.NavigableSet<@KeyFor("this") javax.lang.model.element.AnnotationMirror>
        Specified by:
        headSet in interface java.util.SortedSet<javax.lang.model.element.AnnotationMirror>
      • tailSet

        public AnnotationMirrorSet tailSet​(javax.lang.model.element.AnnotationMirror fromElement)
        Specified by:
        tailSet in interface java.util.NavigableSet<@KeyFor("this") javax.lang.model.element.AnnotationMirror>
        Specified by:
        tailSet in interface java.util.SortedSet<javax.lang.model.element.AnnotationMirror>