Package 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 extends Object,T_CONS extends Object,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 Description ResultsetSpliterator(RecordMapper<T> recordMapper, Criteria criteria, Statement statement, ResultSet resultSet)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
run()
Method to be run onClose() of associated streamboolean
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 Tcriteria
- a Criteriastatement
- the statement that created the ResultSetresultSet
- the JDBC result set- Throws:
TorqueException
- backend database exception
-
-
Method Detail
-
tryAdvance
public boolean tryAdvance(Consumer<? super T> action)
- Specified by:
tryAdvance
in interfaceSpliterator<T>
-
run
public void run()
Method to be run onClose() of associated stream- Specified by:
run
in interfaceRunnable
- See Also:
Runnable.run()
-
-