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 java.lang.Comparable<V>>, JinqStream.CollectDouble<U>, JinqStream.CollectInteger<U>, JinqStream.CollectLong<U>, JinqStream.CollectNumber<U,V extends java.lang.Number & java.lang.Comparable<V>>, JinqStream.Join<U,V>, JinqStream.JoinWithSource<U,V>, JinqStream.Select<U,V>, JinqStream.SelectWithSource<U,V>, JinqStream.Where<U,E extends java.lang.Exception>, JinqStream.WhereWithSource<U,E extends java.lang.Exception>inQueryStreamSource, recordedExceptions| Constructor and Description |
|---|
QueryJinqStream(QueryComposer<T> query) |
QueryJinqStream(QueryComposer<T> query,
InQueryStreamSource inQueryStreamSource) |
| Modifier and Type | Method and Description |
|---|---|
<V extends java.lang.Number & java.lang.Comparable<V>> |
avg(JinqStream.CollectNumber<T,V> aggregate)
Finds the average of the element of a stream.
|
long |
count()
Counts the elements in the stream.
|
protected java.util.stream.Stream<T> |
createWrappedStream() |
JinqStream<T> |
distinct() |
java.lang.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>> |
leftOuterJoin(JinqStream.Join<T,U> join)
Pairs up each entry of the stream with a stream of related elements.
|
JinqStream<T> |
limit(long n) |
<V extends java.lang.Comparable<V>> |
max(JinqStream.CollectComparable<T,V> aggregate)
Finds the largest or maximum element of a stream.
|
<V extends java.lang.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.
|
JinqStream<T> |
setHint(java.lang.String name,
java.lang.Object value)
Sets a hint on the stream for how the query should be executed
|
JinqStream<T> |
skip(long n) |
<V extends java.lang.Comparable<V>> |
sortedBy(JinqStream.CollectComparable<T,V> sorter)
Sorts the elements of a stream in ascending order based on the value
returned.
|
<V extends java.lang.Comparable<V>> |
sortedDescendingBy(JinqStream.CollectComparable<T,V> sorter)
Sorts the elements of a stream in descending order based on the value
returned.
|
java.math.BigDecimal |
sumBigDecimal(JinqStream.CollectBigDecimal<T> aggregate) |
java.math.BigInteger |
sumBigInteger(JinqStream.CollectBigInteger<T> aggregate) |
java.lang.Double |
sumDouble(JinqStream.CollectDouble<T> aggregate) |
java.lang.Long |
sumInteger(JinqStream.CollectInteger<T> aggregate)
Calculates a sum over the elements of a stream.
|
java.lang.Long |
sumLong(JinqStream.CollectLong<T> aggregate) |
<E extends java.lang.Exception> |
where(JinqStream.Where<T,E> test)
Filters the elements of the stream.
|
<E extends java.lang.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, toArraypublic QueryJinqStream(QueryComposer<T> query)
public QueryJinqStream(QueryComposer<T> query, InQueryStreamSource inQueryStreamSource)
protected java.util.stream.Stream<T> createWrappedStream()
createWrappedStream in class LazyWrappedStream<T>public <E extends java.lang.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 java.lang.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<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>> leftOuterJoin(JinqStream.Join<T,U> join)
JinqStream
JinqStream<Country> stream = ...;
JinqStream<Pair<Country, Mountain>> result =
stream.join(c -> JinqStream.from(c.getMountain()));
JinqStream<Pair<Country, Mountain>> result =
stream.join(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)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 java.lang.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 java.lang.Long sumLong(JinqStream.CollectLong<T> aggregate)
sumLong in interface JinqStream<T>sumLong in class NonQueryJinqStream<T>JinqStream.sumInteger(CollectInteger)public java.lang.Double sumDouble(JinqStream.CollectDouble<T> aggregate)
sumDouble in interface JinqStream<T>sumDouble in class NonQueryJinqStream<T>JinqStream.sumInteger(CollectInteger)public java.math.BigDecimal sumBigDecimal(JinqStream.CollectBigDecimal<T> aggregate)
sumBigDecimal in interface JinqStream<T>sumBigDecimal in class NonQueryJinqStream<T>JinqStream.sumInteger(CollectInteger)public java.math.BigInteger sumBigInteger(JinqStream.CollectBigInteger<T> aggregate)
sumBigInteger in interface JinqStream<T>sumBigInteger in class NonQueryJinqStream<T>JinqStream.sumInteger(CollectInteger)public <V extends java.lang.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 java.lang.Comparable<V>> V min(JinqStream.CollectComparable<T,V> aggregate)
JinqStream
JinqStream<Student> stream = ...;
Date birthdayOfYoungest = stream.max(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 java.lang.Number & java.lang.Comparable<V>> java.lang.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 java.lang.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 java.lang.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 java.lang.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(java.lang.String name, java.lang.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 © 2014. All Rights Reserved.