- All Superinterfaces:
Collection<Attribute>
,Iterable<Attribute>
,List<Attribute>
,SequencedCollection<Attribute>
- All Known Subinterfaces:
TargetList.Projection
,TupleDescriptor
,TupleDescriptor.Ephemeral
,TupleDescriptor.Interned
TargetList
is more general than Projection
: in a
Projection
, no attribute can appear more than once, but repetition
is possible in a TargetList
.
In general, it will be more efficient, if processing logic requires more than
one copy of some attribute's value, to simply mention the attribute once in a
Projection
, and have the Java logic then copy the value, rather than
fetching and converting it twice from the database native form. But there
may be cases where that isn't workable, such as when the value is needed in
different Java representations from different Adapter
s, or when the
Java representation is a type like SQLXML
that can only be used once.
Such cases call for a TargetList
in which the attribute is mentioned
more than once, to be separately fetched.
Given a TargetList
, query results can be processed by supplying a
lambda body to applyOver
. The
lambda will be supplied a Cursor
whose apply
methods
can be used to break out the wanted values on each row, in the
TargetList
order.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
ATargetList
that has been bound to a source of tuples and can execute code with the wanted attribute values available.static interface
ATargetList
in which no one attribute may appear more than once. -
Method Summary
Modifier and TypeMethodDescription<R,
X extends Throwable>
RapplyOver
(Iterable<TupleTableSlot> tuples, TargetList.Cursor.Function<R, X> f) Executes the function f, once, supplying aCursor
that can be iterated over the supplied tuples and used to process each tuple.<R,
X extends Throwable>
RapplyOver
(TupleTableSlot tuple, TargetList.Cursor.Function<R, X> f) Executes the function f, once, supplying aCursor
that can be used to process the tuple.default Attribute
sqlGet
(int oneBasedIndex) Likeget
but following the SQL convention where the first element has index 1.subList
(int fromIndex, int toIndex) Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.List
add, add, addAll, addAll, addFirst, addLast, clear, contains, containsAll, equals, get, getFirst, getLast, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeFirst, removeLast, replaceAll, retainAll, reversed, set, size, sort, spliterator, toArray, toArray
-
Method Details
-
subList
-
sqlGet
Likeget
but following the SQL convention where the first element has index 1. -
applyOver
<R,X extends Throwable> R applyOver(Iterable<TupleTableSlot> tuples, TargetList.Cursor.Function<R, X> f) throws X, SQLExceptionExecutes the function f, once, supplying aCursor
that can be iterated over the supplied tuples and used to process each tuple.- Returns:
- whatever f returns.
- Throws:
X
SQLException
-
applyOver
<R,X extends Throwable> R applyOver(TupleTableSlot tuple, TargetList.Cursor.Function<R, X> f) throws X, SQLExceptionExecutes the function f, once, supplying aCursor
that can be used to process the tuple.The
Cursor
can be iterated, just as if a one-rowIterable<TupleTableSlot>
had been passed toapplyOver(tuples, f)
, but it need not be; it will already have the single supplied tuple as its current row, ready for itsapply
methods to be used.- Returns:
- whatever f returns.
- Throws:
X
SQLException
-