Class SuperclassIterable<T>

  • All Implemented Interfaces:
    java.lang.Iterable<java.lang.Class<? super T>>

    public final class SuperclassIterable<T>
    extends java.lang.Object
    implements java.lang.Iterable<java.lang.Class<? super T>>
    Iterable to iterate over all superclasses of a class.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Iterator<java.lang.Class<? super T>> iterator()
      Returns an iterator over all superclasses of the class.
      static <T> SuperclassIterable<T> of​(java.lang.Class<T> type)
      Factory method for a SuperlcassIterator that iterates over type's superclasses, excluding itself and excluding Object.
      static <T> SuperclassIterable<T> ofIncludeSelf​(java.lang.Class<T> type)
      Factory method for a SuperlcassIterator that iterates over type's superclasses, including itself but excluding Object.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Method Detail

      • of

        public static <T> SuperclassIterable<T> of​(java.lang.Class<T> type)
        Factory method for a SuperlcassIterator that iterates over type's superclasses, excluding itself and excluding Object.
        Type Parameters:
        T - Type parameter for type.
        Parameters:
        type - The class over whose superclasses to iterate.
        Returns:
        A SuperclassIterator.
      • ofIncludeSelf

        public static <T> SuperclassIterable<T> ofIncludeSelf​(java.lang.Class<T> type)
        Factory method for a SuperlcassIterator that iterates over type's superclasses, including itself but excluding Object.
        Type Parameters:
        T - Type parameter for type.
        Parameters:
        type - The class over whose superclasses to iterate.
        Returns:
        A SuperclassIterator.
      • iterator

        public java.util.Iterator<java.lang.Class<? super T>> iterator()
        Returns an iterator over all superclasses of the class. Is empty if type has no superclasses and SuperclassIterable does not include self.
        Specified by:
        iterator in interface java.lang.Iterable<T>
        Returns:
        The iterator.