public class QueryJinqStream<T> extends NonQueryJinqStream<T> implements JinqStream<T>
NonQueryJinqStream.IteratorTee<T>JinqStream.AggregateGroup<W,U,V>, JinqStream.AggregateSelect<U,V>, JinqStream.CollectBigDecimal<U>, JinqStream.CollectBigInteger<U>, JinqStream.CollectComparable<U,V extends Comparable<V>>, JinqStream.CollectDouble<U>, JinqStream.CollectInteger<U>, JinqStream.CollectLong<U>, JinqStream.CollectNumber<U,V extends Number & Comparable<V>>, JinqStream.Join<U,V>, JinqStream.JoinToIterable<U,V>, JinqStream.JoinWithSource<U,V>, JinqStream.Select<U,V>, JinqStream.SelectWithSource<U,V>, JinqStream.Where<U,E extends Exception>, JinqStream.WhereWithSource<U,E extends Exception>java.util.stream.Stream.Builder<T>inQueryStreamSource, recordedExceptions| Constructor and Description |
|---|
QueryJinqStream(QueryComposer<T> query) |
QueryJinqStream(QueryComposer<T> query,
InQueryStreamSource inQueryStreamSource) |
| Modifier and Type | Method and Description |
|---|---|
<V extends Number & Comparable<V>> |
avg(JinqStream.CollectNumber<T,V> aggregate)
Finds the average of the elements of a stream.
|
long |
count()
Counts the elements in the stream.
|
protected java.util.stream.Stream<T> |
createWrappedStream() |
JinqStream<T> |
distinct() |
String |
getDebugQueryString()
Returns the query that Jinq will send to the database to generate the
values of the stream.
|
protected <U,W extends Tuple> |
groupToTuple(JinqStream.Select<T,U> select,
JinqStream.AggregateGroup<U,T,?>[] aggregates) |
<U> JinqStream<Pair<T,U>> |
join(JinqStream.Join<T,U> join)
Pairs up each entry of the stream with a stream of related elements.
|
<U> JinqStream<Pair<T,U>> |
join(JinqStream.JoinWithSource<T,U> join)
Pairs up each entry of the stream with a stream of related elements.
|
<U> JinqStream<Pair<T,U>> |
joinList(JinqStream.JoinToIterable<T,U> join)
A variant of join() that can be used if you want to join to a
collection without the trouble of converting it to a JinqStream
first.
|
<U> JinqStream<Pair<T,U>> |
leftOuterJoin(JinqStream.Join<T,U> join)
Pairs up each entry of the stream with a stream of related elements.
|
<U> JinqStream<Pair<T,U>> |
leftOuterJoinList(JinqStream.JoinToIterable<T,U> join)
A variant of leftOuterJoin() that can be used if you want to join to a
collection without the trouble of converting it to a JinqStream
first.
|
JinqStream<T> |
limit(long n) |
protected <U> JinqStream<U> |
makeQueryStream(QueryComposer<U> query,
InQueryStreamSource inQueryStreamSource) |
<V extends Comparable<V>> |
max(JinqStream.CollectComparable<T,V> aggregate)
Finds the largest or maximum element of a stream.
|
<V extends Comparable<V>> |
min(JinqStream.CollectComparable<T,V> aggregate)
Finds the smallest or minimum element of a stream.
|
<U> JinqStream<U> |
select(JinqStream.Select<T,U> select)
Transforms the elements in the stream.
|
<U> JinqStream<U> |
select(JinqStream.SelectWithSource<T,U> select)
Transforms the elements in the stream.
|
<U> JinqStream<U> |
selectAll(JinqStream.Join<T,U> select)
Transforms the elements in the stream.
|
<U> JinqStream<U> |
selectAll(JinqStream.JoinWithSource<T,U> select)
Transforms the elements in the stream.
|
<U> JinqStream<U> |
selectAllList(JinqStream.JoinToIterable<T,U> select)
A variant of selectAll() that can be used if you want to join to a
collection without the trouble of converting it to a JinqStream
first.
|
JinqStream<T> |
setHint(String name,
Object value)
Sets a hint on the stream for how the query should be executed
|
JinqStream<T> |
skip(long n) |
<V extends Comparable<V>> |
sortedBy(JinqStream.CollectComparable<T,V> sorter)
Sorts the elements of a stream in ascending order based on the value
returned.
|
<V extends Comparable<V>> |
sortedDescendingBy(JinqStream.CollectComparable<T,V> sorter)
Sorts the elements of a stream in descending order based on the value
returned.
|
BigDecimal |
sumBigDecimal(JinqStream.CollectBigDecimal<T> aggregate) |
BigInteger |
sumBigInteger(JinqStream.CollectBigInteger<T> aggregate) |
Double |
sumDouble(JinqStream.CollectDouble<T> aggregate) |
Long |
sumInteger(JinqStream.CollectInteger<T> aggregate)
Calculates a sum over the elements of a stream.
|
Long |
sumLong(JinqStream.CollectLong<T> aggregate) |
<E extends Exception> |
where(JinqStream.Where<T,E> test)
Filters the elements of the stream.
|
<E extends Exception> |
where(JinqStream.WhereWithSource<T,E> test)
Filters the elements of the stream.
|
aggregate, aggregate, aggregate, aggregate, getExceptions, getOnlyValue, group, group, group, group, propagateException, toList, wrapallMatch, anyMatch, close, collect, collect, filter, findAny, findFirst, flatMap, flatMapToDouble, flatMapToInt, flatMapToLong, forEach, forEachOrdered, isParallel, iterator, map, mapToDouble, mapToInt, mapToLong, max, min, noneMatch, onClose, parallel, peek, realizeStream, reduce, reduce, reduce, sequential, sorted, sorted, spliterator, toArray, toArray, unorderedclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaggregate, aggregate, aggregate, aggregate, from, getExceptions, getOnlyValue, group, group, group, group, of, propagateException, toListallMatch, anyMatch, builder, collect, collect, concat, empty, filter, findAny, findFirst, flatMap, flatMapToDouble, flatMapToInt, flatMapToLong, forEach, forEachOrdered, generate, iterate, map, mapToDouble, mapToInt, mapToLong, max, min, noneMatch, peek, reduce, reduce, reduce, sorted, sorted, toArray, toArrayclose, isParallel, iterator, onClose, parallel, sequential, spliterator, unorderedpublic QueryJinqStream(QueryComposer<T> query)
public QueryJinqStream(QueryComposer<T> query, InQueryStreamSource inQueryStreamSource)
protected <U> JinqStream<U> makeQueryStream(QueryComposer<U> query, InQueryStreamSource inQueryStreamSource)
protected java.util.stream.Stream<T> createWrappedStream()
createWrappedStream in class LazyWrappedStream<T>public <E extends Exception> JinqStream<T> where(JinqStream.Where<T,E> test)
JinqStream
JinqStream<Customer> stream = ...;
JinqStream<Customer> result = stream.where(c -> c.getName().equals("Alice"));
where in interface JinqStream<T>where in class NonQueryJinqStream<T>test - function applied to the elements of the stream. When passed an
element from the stream, the function should return true if the
element should be kept. if the function returns false, the
element is discarded.public <E extends Exception> JinqStream<T> where(JinqStream.WhereWithSource<T,E> test)
JinqStreamwhere in interface JinqStream<T>where in class NonQueryJinqStream<T>test - function applied to each element of the stream. The function is
passed an element from the stream as well as an
InQueryStreamSource. The function should return true if
the element should be kept. if the function returns false, the
element is discarded.JinqStream.where(Where)public <U> JinqStream<U> select(JinqStream.Select<T,U> select)
JinqStream
JinqStream<Customer> stream = ...;
JinqStream<String> result = stream.select(c -> c.getName());
select in interface JinqStream<T>select in class NonQueryJinqStream<T>select - function applied to the elements of the stream. When passed an
element from the stream, the function should return a new value
that should be used instead of the element in the stream.public <U> JinqStream<U> select(JinqStream.SelectWithSource<T,U> select)
JinqStreamInQueryStreamSource to the select function so that the function
can create new streams of elements to use in subqueries.select in interface JinqStream<T>select in class NonQueryJinqStream<T>JinqStream.select(Select)public <U> JinqStream<U> selectAll(JinqStream.Join<T,U> select)
JinqStream
JinqStream<Country> stream = ...;
JinqStream<City> result = stream.selectAll(c -> JinqStream.from(c.getCities()));
selectAll in interface JinqStream<T>selectAll in class NonQueryJinqStream<T>select - function applied to the elements of the stream. When passed an
element from the stream, the function should return a stream of
new values that will be flattened and placed in the new streamJinqStream.select(Select)public <U> JinqStream<U> selectAll(JinqStream.JoinWithSource<T,U> select)
JinqStreamInQueryStreamSource to the select function so that the function
can create new streams of elements to use in subqueries.selectAll in interface JinqStream<T>selectAll in class NonQueryJinqStream<T>JinqStream.selectAll(Join)public <U> JinqStream<U> selectAllList(JinqStream.JoinToIterable<T,U> select)
JinqStream
JinqStream<Country> stream = ...;
JinqStream<City> result = stream.selectAll(c -> c.getCities());
selectAllList in interface JinqStream<T>selectAllList in class NonQueryJinqStream<T>select - function applied to the elements of the stream. When passed an
element from the stream, the function should return a collection
of new values that will be flattened and placed in the new streamJinqStream.selectAll(Join)public <U> JinqStream<Pair<T,U>> join(JinqStream.Join<T,U> join)
JinqStream
JinqStream<Country> stream = ...;
JinqStream<Pair<Country, City>> result =
stream.join(c -> JinqStream.from(c.getCities()));
join in interface JinqStream<T>join in class NonQueryJinqStream<T>join - function applied to the elements of the stream. When passed an
element from the stream, the function should return a stream of
values that should be paired up with that stream element.public <U> JinqStream<Pair<T,U>> join(JinqStream.JoinWithSource<T,U> join)
JinqStreamInQueryStreamSource to the join function so
that the function can join elements with unrelated streams of entities
from a database.join in interface JinqStream<T>join in class NonQueryJinqStream<T>JinqStream.join(Join)public <U> JinqStream<Pair<T,U>> joinList(JinqStream.JoinToIterable<T,U> join)
JinqStreamjoinList in interface JinqStream<T>joinList in class NonQueryJinqStream<T>JinqStream.join(Join)public <U> JinqStream<Pair<T,U>> leftOuterJoin(JinqStream.Join<T,U> join)
JinqStream
JinqStream<Country> stream = ...;
JinqStream<Pair<Country, Mountain>> result =
stream.leftOuterJoin(c -> JinqStream.from(c.getMountain()));
JinqStream<Pair<Country, Mountain>> result =
stream.leftOuterJoin(c -> JinqStream.of(c.getHighestMountain()));
leftOuterJoin in interface JinqStream<T>leftOuterJoin in class NonQueryJinqStream<T>join - function applied to the elements of the stream. When passed an
element from the stream, the function should return a stream of
values that should be paired up with that stream element. The
function must use a JPA association or navigational link as the
base for the stream returned. Both singular or plural
associations are allowed.JinqStream.join(Join)public <U> JinqStream<Pair<T,U>> leftOuterJoinList(JinqStream.JoinToIterable<T,U> join)
JinqStreamleftOuterJoinList in interface JinqStream<T>leftOuterJoinList in class NonQueryJinqStream<T>JinqStream.leftOuterJoin(Join)protected <U,W extends Tuple> JinqStream<W> groupToTuple(JinqStream.Select<T,U> select, JinqStream.AggregateGroup<U,T,?>[] aggregates)
groupToTuple in class NonQueryJinqStream<T>public long count()
JinqStreamcount in interface java.util.stream.Stream<T>count in interface JinqStream<T>count in class LazyWrappedStream<T>Stream.count()public Long sumInteger(JinqStream.CollectInteger<T> aggregate)
JinqStream
JinqStream<City> stream = ...;
long totalPopulation = stream.sumInteger(c -> c.getPopulation());
sumInteger in interface JinqStream<T>sumInteger in class NonQueryJinqStream<T>aggregate - function applied to each element of the stream. When passed an
element of the stream, it should return the value that should be
added to the sum.public Long sumLong(JinqStream.CollectLong<T> aggregate)
sumLong in interface JinqStream<T>sumLong in class NonQueryJinqStream<T>JinqStream.sumInteger(CollectInteger)public Double sumDouble(JinqStream.CollectDouble<T> aggregate)
sumDouble in interface JinqStream<T>sumDouble in class NonQueryJinqStream<T>JinqStream.sumInteger(CollectInteger)public BigDecimal sumBigDecimal(JinqStream.CollectBigDecimal<T> aggregate)
sumBigDecimal in interface JinqStream<T>sumBigDecimal in class NonQueryJinqStream<T>JinqStream.sumInteger(CollectInteger)public BigInteger sumBigInteger(JinqStream.CollectBigInteger<T> aggregate)
sumBigInteger in interface JinqStream<T>sumBigInteger in class NonQueryJinqStream<T>JinqStream.sumInteger(CollectInteger)public <V extends Comparable<V>> V max(JinqStream.CollectComparable<T,V> aggregate)
JinqStream
JinqStream<Student> stream = ...;
Date birthdayOfYoungest = stream.max(s -> s.getBirthday());
max in interface JinqStream<T>max in class NonQueryJinqStream<T>aggregate - function applied to each element of the stream. When passed an
element of the stream, it should return the value that should be
compared.public <V extends Comparable<V>> V min(JinqStream.CollectComparable<T,V> aggregate)
JinqStream
JinqStream<Student> stream = ...;
Date birthdayOfOldest = stream.min(s -> s.getBirthday());
min in interface JinqStream<T>min in class NonQueryJinqStream<T>aggregate - function applied to each element of the stream. When passed an
element of the stream, it should return the value that should be
compared.JinqStream.max(CollectComparable)public <V extends Number & Comparable<V>> Double avg(JinqStream.CollectNumber<T,V> aggregate)
JinqStream
JinqStream<Student> stream = ...;
double averageAge = stream.avg(s -> s.getage());
avg in interface JinqStream<T>avg in class NonQueryJinqStream<T>aggregate - function applied to each element of the stream. When passed an
element of the stream, it should return the value that should be
included in the averagepublic <V extends Comparable<V>> JinqStream<T> sortedBy(JinqStream.CollectComparable<T,V> sorter)
JinqStreamsortedBy in interface JinqStream<T>sortedBy in class NonQueryJinqStream<T>sorter - function applied to each element of the stream. When passed an
element of the stream, it should return the value that should be
used as the sorting value of the elementpublic <V extends Comparable<V>> JinqStream<T> sortedDescendingBy(JinqStream.CollectComparable<T,V> sorter)
JinqStreamsortedDescendingBy in interface JinqStream<T>sortedDescendingBy in class NonQueryJinqStream<T>sorter - function applied to each element of the stream. When passed an
element of the stream, it should return the value that should be
used as the sorting value of the elementJinqStream.sortedBy(CollectComparable)public JinqStream<T> limit(long n)
limit in interface java.util.stream.Stream<T>limit in interface JinqStream<T>limit in class NonQueryJinqStream<T>public JinqStream<T> skip(long n)
skip in interface java.util.stream.Stream<T>skip in interface JinqStream<T>skip in class NonQueryJinqStream<T>public JinqStream<T> distinct()
distinct in interface java.util.stream.Stream<T>distinct in interface JinqStream<T>distinct in class NonQueryJinqStream<T>public String getDebugQueryString()
JinqStreamgetDebugQueryString in interface JinqStream<T>getDebugQueryString in class NonQueryJinqStream<T>null if Jinq cannot find
a database query equivalent to the contents of the stream.public JinqStream<T> setHint(String name, Object value)
JinqStreamsetHint in interface JinqStream<T>setHint in class NonQueryJinqStream<T>name - name of the hint to changevalue - value to assign to the hintCopyright © 2015. All Rights Reserved.