Class FieldIterable

  • All Implemented Interfaces:
    Iterable<Field>

    public final class FieldIterable
    extends Object
    implements Iterable<Field>
    Iterable to iterate over all declared fields in a class and, if needed, over all declared fields of its superclasses.
    • Method Detail

      • of

        public static FieldIterable of​(Class<?> type)
        Factory method for a FieldIterable that iterates over all declared fields of type and over the declared fields of all of its superclasses.
        Parameters:
        type - The class that contains the fields over which to iterate.
        Returns:
        A FieldIterable.
      • ofIgnoringSuper

        public static FieldIterable ofIgnoringSuper​(Class<?> type)
        Factory method for a FieldIterable that iterates over all declared fields of type, but that ignores the declared fields of its superclasses.
        Parameters:
        type - The class that contains the fields over which to iterate.
        Returns:
        A FieldIterable.
      • ofIgnoringStatic

        public static FieldIterable ofIgnoringStatic​(Class<?> type)
        Factory method for a FieldIterable that iterates over all declared fields of type, but that ignores its static fields.
        Parameters:
        type - The class that contains the fields over which to iterate.
        Returns:
        A FieldIterable.
      • iterator

        public Iterator<Field> iterator()
        Returns an iterator over all declared fields of the class and all of its superclasses.
        Specified by:
        iterator in interface Iterable<Field>
        Returns:
        An iterator over all declared fields of the class and all of its superclasses.