org.apache.torque.util

## Class ResultsetSpliterator<T>

- java.lang.Object
- - java.util.Spliterators.AbstractSpliterator<T>
  - - org.apache.torque.util.ResultsetSpliterator<T>

- All Implemented Interfaces:
    Runnable, Spliterator<T>

      public class ResultsetSpliterator<T>
      extends Spliterators.AbstractSpliterator<T>
      implements Runnable

  Stream support: Encapsulate iteration over a JDBC ResultSet
  Author:
    Thomas Vandahl

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface java.util.Spliterator

      `Spliterator.OfDouble, Spliterator.OfInt, Spliterator.OfLong, Spliterator.OfPrimitive<T,T_CONS,T_SPLITR extends Spliterator.OfPrimitive<T,T_CONS,T_SPLITR>>`

  - ### Field Summary

    - ### Fields inherited from interface java.util.Spliterator

      `CONCURRENT, DISTINCT, IMMUTABLE, NONNULL, ORDERED, SIZED, SORTED, SUBSIZED`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ResultsetSpliterator(RecordMapper<T> recordMapper, Criteria criteria, Statement statement, ResultSet resultSet)` Constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `run()` Method to be run onClose() of associated stream
    `boolean` | `tryAdvance(Consumer<? super T> action)`

    - ### Methods inherited from class java.util.Spliterators.AbstractSpliterator

      `characteristics, estimateSize, trySplit`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface java.util.Spliterator

      `forEachRemaining, getComparator, getExactSizeIfKnown, hasCharacteristics`

- - ### Constructor Detail

    - #### ResultsetSpliterator

          public ResultsetSpliterator(RecordMapper<T> recordMapper,
                                      Criteria criteria,
                                      Statement statement,
                                      ResultSet resultSet)
                               throws TorqueException

      Constructor
      Parameters:
        `recordMapper` - a RecordMapper to map ResultSet rows to entities of type T
        `criteria` - a Criteria
        `statement` - the statement that created the ResultSet
        `resultSet` - the JDBC result set
      Throws:
        `TorqueException` - backend database exception

  - ### Method Detail

    - #### tryAdvance

          public boolean tryAdvance(Consumer<? super T> action)

      Specified by:
        `tryAdvance` in interface `Spliterator<T>`

    - #### run

          public void run()

      Method to be run onClose() of associated stream
      Specified by:
        `run` in interface `Runnable`
      See Also:
        `Runnable.run()`

Copyright © 2000–2020 The Apache Software Foundation. All rights reserved.