public class NonQueryJinqStream<T> extends LazyWrappedStream<T> implements JinqStream<T>
| Modifier and Type | Class and Description |
|---|---|
static class |
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>| Modifier and Type | Field and Description |
|---|---|
protected InQueryStreamSource |
inQueryStreamSource |
protected java.util.Map<java.lang.Object,java.lang.Throwable> |
recordedExceptions |
| Constructor and Description |
|---|
NonQueryJinqStream(java.util.stream.Stream<T> wrapped) |
NonQueryJinqStream(java.util.stream.Stream<T> wrapped,
InQueryStreamSource inQueryStreamSource) |
| Modifier and Type | Method and Description |
|---|---|
<U,V> Pair<U,V> |
aggregate(JinqStream.AggregateSelect<T,U> aggregate1,
JinqStream.AggregateSelect<T,V> aggregate2)
Calculates more than one aggregate function over the elements of the
stream.
|
<U,V,W> Tuple3<U,V,W> |
aggregate(JinqStream.AggregateSelect<T,U> aggregate1,
JinqStream.AggregateSelect<T,V> aggregate2,
JinqStream.AggregateSelect<T,W> aggregate3) |
<U,V,W,X> Tuple4<U,V,W,X> |
aggregate(JinqStream.AggregateSelect<T,U> aggregate1,
JinqStream.AggregateSelect<T,V> aggregate2,
JinqStream.AggregateSelect<T,W> aggregate3,
JinqStream.AggregateSelect<T,X> aggregate4) |
<U,V,W,X,Y> |
aggregate(JinqStream.AggregateSelect<T,U> aggregate1,
JinqStream.AggregateSelect<T,V> aggregate2,
JinqStream.AggregateSelect<T,W> aggregate3,
JinqStream.AggregateSelect<T,X> aggregate4,
JinqStream.AggregateSelect<T,Y> aggregate5) |
<V extends java.lang.Number & java.lang.Comparable<V>> |
avg(JinqStream.CollectNumber<T,V> aggregate)
Finds the average of the element of a stream.
|
JinqStream<T> |
distinct() |
java.lang.String |
getDebugQueryString()
Returns the query that Jinq will send to the database to generate the
values of the stream.
|
java.util.Collection<java.lang.Throwable> |
getExceptions() |
T |
getOnlyValue()
If the stream contains only a single value, this method will return that
value.
|
<U,V> JinqStream<Pair<U,V>> |
group(JinqStream.Select<T,U> select,
JinqStream.AggregateGroup<U,T,V> aggregate)
Groups together elements from the stream that share a common key.
|
<U,V,W> JinqStream<Tuple3<U,V,W>> |
group(JinqStream.Select<T,U> select,
JinqStream.AggregateGroup<U,T,V> aggregate1,
JinqStream.AggregateGroup<U,T,W> aggregate2)
Calculates two aggregate values instead of one aggregate value for grouped
stream elements.
|
<U,V,W,X> JinqStream<Tuple4<U,V,W,X>> |
group(JinqStream.Select<T,U> select,
JinqStream.AggregateGroup<U,T,V> aggregate1,
JinqStream.AggregateGroup<U,T,W> aggregate2,
JinqStream.AggregateGroup<U,T,X> aggregate3)
Calculates three aggregate values instead of one aggregate value for
grouped stream elements.
|
<U,V,W,X,Y> |
group(JinqStream.Select<T,U> select,
JinqStream.AggregateGroup<U,T,V> aggregate1,
JinqStream.AggregateGroup<U,T,W> aggregate2,
JinqStream.AggregateGroup<U,T,X> aggregate3,
JinqStream.AggregateGroup<U,T,Y> aggregate4)
Calculates four aggregate values instead of one aggregate value for
grouped stream elements.
|
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.
|
void |
propagateException(java.lang.Object source,
java.lang.Throwable exception)
Used for recording an exception that occurred during processing somewhere
in the stream chain.
|
<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> sortField)
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> sortField)
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) |
java.util.List<T> |
toList()
Convenience method that collects the stream contents into a List.
|
<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.
|
protected <U> JinqStream<U> |
wrap(java.util.stream.Stream<U> toWrap)
Allows subclasses to wrap streams generated by this class
with wrappers that provide additional functionality.
|
allMatch, anyMatch, close, collect, collect, count, createWrappedStream, 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, waitcount, from, ofallMatch, 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, toArrayprotected InQueryStreamSource inQueryStreamSource
protected java.util.Map<java.lang.Object,java.lang.Throwable> recordedExceptions
public NonQueryJinqStream(java.util.stream.Stream<T> wrapped)
public NonQueryJinqStream(java.util.stream.Stream<T> wrapped, InQueryStreamSource inQueryStreamSource)
protected <U> JinqStream<U> wrap(java.util.stream.Stream<U> toWrap)
LazyWrappedStreamwrap 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>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>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 - 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>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 - 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>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>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)
public <U,V> JinqStream<Pair<U,V>> group(JinqStream.Select<T,U> select, JinqStream.AggregateGroup<U,T,V> aggregate)
JinqStream
JinqStream<City> stream = ...;
JinqStream<Pair<String, Long>> result =
stream.group(c -> c.getCountry(), (key, cities) -> cities.count());
group in interface JinqStream<T>select - function applied to each element of the stream that returns the
key to be used to group elements togetheraggregate - function applied to each group and calculates an aggregate value
over the group. The function is passed the key for the group and
a JinqStream of elements contained inside that group. It should
return the aggregate value calculated for that group.public <U,V,W> JinqStream<Tuple3<U,V,W>> group(JinqStream.Select<T,U> select, JinqStream.AggregateGroup<U,T,V> aggregate1, JinqStream.AggregateGroup<U,T,W> aggregate2)
JinqStreamgroup in interface JinqStream<T>JinqStream.group(Select, AggregateGroup)public <U,V,W,X> JinqStream<Tuple4<U,V,W,X>> group(JinqStream.Select<T,U> select, JinqStream.AggregateGroup<U,T,V> aggregate1, JinqStream.AggregateGroup<U,T,W> aggregate2, JinqStream.AggregateGroup<U,T,X> aggregate3)
JinqStreamgroup in interface JinqStream<T>JinqStream.group(Select, AggregateGroup)public <U,V,W,X,Y> JinqStream<Tuple5<U,V,W,X,Y>> group(JinqStream.Select<T,U> select, JinqStream.AggregateGroup<U,T,V> aggregate1, JinqStream.AggregateGroup<U,T,W> aggregate2, JinqStream.AggregateGroup<U,T,X> aggregate3, JinqStream.AggregateGroup<U,T,Y> aggregate4)
JinqStreamgroup in interface JinqStream<T>JinqStream.group(Select, AggregateGroup)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>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>JinqStream.sumInteger(CollectInteger)public java.lang.Double sumDouble(JinqStream.CollectDouble<T> aggregate)
sumDouble in interface JinqStream<T>JinqStream.sumInteger(CollectInteger)public java.math.BigDecimal sumBigDecimal(JinqStream.CollectBigDecimal<T> aggregate)
sumBigDecimal in interface JinqStream<T>JinqStream.sumInteger(CollectInteger)public java.math.BigInteger sumBigInteger(JinqStream.CollectBigInteger<T> aggregate)
sumBigInteger in interface JinqStream<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>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>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>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> sortField)
JinqStreamsortedBy in interface JinqStream<T>sortField - 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> sortField)
JinqStreamsortedDescendingBy in interface JinqStream<T>sortField - 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> skip(long n)
skip in interface java.util.stream.Stream<T>skip in interface JinqStream<T>skip in class LazyWrappedStream<T>public JinqStream<T> limit(long n)
limit in interface java.util.stream.Stream<T>limit in interface JinqStream<T>limit in class LazyWrappedStream<T>public JinqStream<T> distinct()
distinct in interface java.util.stream.Stream<T>distinct in interface JinqStream<T>distinct in class LazyWrappedStream<T>public T getOnlyValue()
JinqStreamgetOnlyValue in interface JinqStream<T>public java.util.List<T> toList()
JinqStreamtoList in interface JinqStream<T>public java.lang.String getDebugQueryString()
JinqStreamgetDebugQueryString in interface JinqStream<T>null if Jinq cannot find
a database query equivalent to the contents of the stream.public void propagateException(java.lang.Object source,
java.lang.Throwable exception)
JinqStreampropagateException in interface JinqStream<T>source - lambda object that caused the exception (used so that if the
same lambda causes multiple exceptions, only some of them need
to be recorded in order to avoid memory issues)exception - actual exception objectpublic java.util.Collection<java.lang.Throwable> getExceptions()
getExceptions in interface JinqStream<T>public <U,V> Pair<U,V> aggregate(JinqStream.AggregateSelect<T,U> aggregate1, JinqStream.AggregateSelect<T,V> aggregate2)
JinqStream
JinqStream<City> stream = ...;
Pair<Long, Long> result = stream.aggregate(
c -> c.sumInteger(c.getPopulation()),
c -> c.count());
aggregate in interface JinqStream<T>aggregate1 - a function that takes a stream and returns the first calculated
aggregate value for the streamaggregate2 - a function that takes a stream and returns a second calculated
aggregate value for the streampublic <U,V,W> Tuple3<U,V,W> aggregate(JinqStream.AggregateSelect<T,U> aggregate1, JinqStream.AggregateSelect<T,V> aggregate2, JinqStream.AggregateSelect<T,W> aggregate3)
aggregate in interface JinqStream<T>JinqStream.aggregate(AggregateSelect, AggregateSelect)public <U,V,W,X> Tuple4<U,V,W,X> aggregate(JinqStream.AggregateSelect<T,U> aggregate1, JinqStream.AggregateSelect<T,V> aggregate2, JinqStream.AggregateSelect<T,W> aggregate3, JinqStream.AggregateSelect<T,X> aggregate4)
aggregate in interface JinqStream<T>JinqStream.aggregate(AggregateSelect, AggregateSelect)public <U,V,W,X,Y> Tuple5<U,V,W,X,Y> aggregate(JinqStream.AggregateSelect<T,U> aggregate1, JinqStream.AggregateSelect<T,V> aggregate2, JinqStream.AggregateSelect<T,W> aggregate3, JinqStream.AggregateSelect<T,X> aggregate4, JinqStream.AggregateSelect<T,Y> aggregate5)
aggregate in interface JinqStream<T>JinqStream.aggregate(AggregateSelect, AggregateSelect)public JinqStream<T> setHint(java.lang.String name, java.lang.Object value)
JinqStreamsetHint in interface JinqStream<T>name - name of the hint to changevalue - value to assign to the hintCopyright © 2014. All Rights Reserved.