Class ObjectScanner<T>

java.lang.Object
io.datarouter.scanner.ObjectScanner<T>
All Implemented Interfaces:
Scanner<T>, Closeable, AutoCloseable

public class ObjectScanner<T> extends Object implements Scanner<T>
  • Constructor Details

    • ObjectScanner

      public ObjectScanner(T object)
  • Method Details

    • of

      public static <T> Scanner<T> of(T object)
      Description copied from interface: Scanner
      Convert an Object into a Scanner.
      Parameters:
      object - A non-null Object
      Returns:
      A single-item Scanner with the Object
    • ofNullable

      public static <T> Scanner<T> ofNullable(T object)
      Description copied from interface: Scanner
      Convert an Object into a Scanner if non-null.
      Parameters:
      object - A nullable Object
      Returns:
      An empty scanner if the Object was null, otherwise a single-item Scanner with the Object
    • advance

      public boolean advance()
      Description copied from interface: Scanner
      Try to update current to the next item, if there is one.
      Specified by:
      advance in interface Scanner<T>
      Returns:
      True if it advanced
    • current

      public T current()
      Specified by:
      current in interface Scanner<T>
      Returns:
      The current item, only valid if advance() returned true