Class SuperclassIterable<T>

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

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

      • of

        public static <T> SuperclassIterable<T> of​(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​(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 Iterator<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 Iterable<T>
        Returns:
        The iterator.