Interface ExprValue<X,S extends Expression<X>>
- All Superinterfaces:
ExprStream<X,
,S> QueryConfigurer<AbstractQuery<?>,
,X, S> QueryStream<X,
,S, AbstractQuery<?>, CriteriaQuery<X>, TypedQuery<X>> SearchStream<X,
,S> SearchValue<X,
S>
- All Known Subinterfaces:
BooleanValue
,DoubleValue
,FromValue<X,
,S> IntValue
,LongValue
,PathValue<X,
,S> RootValue<X>
ExprStream
that is guaranteed to return at most a single result.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.dellroad.querystream.jpa.QueryStream
QueryStream.Builder
-
Method Summary
Modifier and TypeMethodDescriptionBind an unbound reference to the items in this stream.Bind an unbound reference to the result of applying the given function to the items in this stream.filter
(SingularAttribute<? super X, Boolean> attribute) Filter results using the specified boolean property.filter
(Function<? super S, ? extends Expression<Boolean>> predicateBuilder) Filter results using the boolean expression produced by the given function.default <K,
V, M extends Map<K, V>>
ExprValue<M,Expression<M>> map
(MapAttribute<? super X, K, V> attribute) Map this stream to an associated map property.default <E,
C extends Collection<E>>
ExprValue<C,Expression<C>> map
(PluralAttribute<? super X, C, E> attribute) Map this stream to an associated collection property.map
(SingularAttribute<? super X, Y> attribute) Map this stream to an associated property.default <Y> ExprValue<Y,
Expression<Y>> map
(Class<Y> type, Function<? super S, ? extends Expression<Y>> exprFunction) Map this stream into a stream whose elements are the result of applying the given function.default DoubleValue
mapToDouble
(SingularAttribute<? super X, ? extends Number> attribute) Map this stream to an associated floating point value.default DoubleValue
mapToDouble
(Function<? super S, ? extends Expression<? extends Number>> doubleExprFunction) Map this stream into a stream of double values that are the result of applying the given function.default <Y> ExprValue<Y,
Expression<Y>> mapToExpr
(Class<Y> type, Function<? super S, ? extends Expression<Y>> exprFunction) Map this stream into a stream whose elements are the result of applying the given function.Map this stream into a stream whose elements are the result of applying the given function.default IntValue
mapToInt
(SingularAttribute<? super X, ? extends Number> attribute) Map this stream to an associated integer value.default IntValue
mapToInt
(Function<? super S, ? extends Expression<? extends Number>> intExprFunction) Map this stream into a stream of integer values that are the result of applying the given function.default LongValue
mapToLong
(SingularAttribute<? super X, ? extends Number> attribute) Map this stream to an associated long value.default LongValue
mapToLong
(Function<? super S, ? extends Expression<? extends Number>> longExprFunction) Map this stream into a stream of long values that are the result of applying the given function.Map this stream into a stream whose elements are the result of applying the given function.Peek at the items in this stream.withFetchGraph
(String name) Configure a fetch graph for this query.withFlushMode
(FlushModeType flushMode) Set theFlushModeType
associated with this query.Associate a hint with this query.Associate hints with this query.withLoadGraph
(String name) Configure a load graph for this query.withLockMode
(LockModeType lockMode) Set theLockModeType
associated with this query.withParam
(Parameter<Calendar> parameter, Calendar value, TemporalType temporalType) Bind the value of a query parameter of typeCalendar
.withParam
(Parameter<Date> parameter, Date value, TemporalType temporalType) Bind the value of a query parameter of typeDate
.Bind the value of a query parameter.withParams
(Iterable<? extends ParamBinding<?>> params) Associate parameter bindings with this query.Methods inherited from interface org.dellroad.querystream.jpa.ExprStream
addRoot, asSubquery, count, countDistinct, distinct, exists, fetch, fetch, fetch, fetch, findAny, findFirst, findSingle, groupBy, groupBy, groupBy, groupByMulti, having, limit, orderBy, orderBy, orderBy, orderBy, orderBy, orderBy, orderByMulti, skip, thenOrderBy, thenOrderBy, thenOrderBy, thenOrderBy
Methods inherited from interface org.dellroad.querystream.jpa.QueryConfigurer
configure
Methods inherited from interface org.dellroad.querystream.jpa.QueryStream
getEntityManager, getFirstResult, getFlushMode, getHints, getLockMode, getMaxResults, getParams, toCriteriaQuery, toQuery
Methods inherited from interface org.dellroad.querystream.jpa.SearchStream
allMatch, allMatch, anyMatch, anyMatch, flatMap, flatMap, flatMap, flatMapKeys, flatMapValues, getQueryType, getResultList, getResultStream, isEmpty, join, join, join, join, join, join, join, join, join, join, join, join, join, join, join, mapToRef, mapToRef, mapToRef, mapToRef, mapToRoot, noneMatch, noneMatch
Methods inherited from interface org.dellroad.querystream.jpa.SearchValue
ifPresent, isPresent, mapToSelection, orElse, orElseGet, orElseThrow, toOptional, value
-
Method Details
-
map
Description copied from interface:SearchStream
Map this stream to an associated property.Unlike
join()
, this method allows mapping to arbitrary, non-entity properties.If the property is an entity, then this method works just like an inner
join()
. In particular, the associated entity must exist. For that reason, and also becausejoin()
returns the more specific typeFromStream
,join()
is preferred over this method when the associated property is an entity.- Specified by:
map
in interfaceSearchStream<X,
S extends Expression<X>> - Type Parameters:
Y
- property type- Parameters:
attribute
- associated property- Returns:
- mapped stream
-
map
default <Y> ExprValue<Y,Expression<Y>> map(Class<Y> type, Function<? super S, ? extends Expression<Y>> exprFunction) Description copied from interface:SearchStream
Map this stream into a stream whose elements are the result of applying the given function.- Specified by:
map
in interfaceSearchStream<X,
S extends Expression<X>> - Type Parameters:
Y
- mapped expression type- Parameters:
type
- new item typeexprFunction
- function mapping this stream'sExpression
to aExpression
- Returns:
- mapped stream
-
map
default <E,C extends Collection<E>> ExprValue<C,Expression<C>> map(PluralAttribute<? super X, C, E> attribute) Description copied from interface:SearchStream
Map this stream to an associated collection property.- Specified by:
map
in interfaceSearchStream<X,
S extends Expression<X>> - Type Parameters:
E
- collection element typeC
- collection type- Parameters:
attribute
- associated property- Returns:
- mapped stream
-
map
default <K,V, ExprValue<M,M extends Map<K, V>> Expression<M>> map(MapAttribute<? super X, K, V> attribute) Description copied from interface:SearchStream
Map this stream to an associated map property.- Specified by:
map
in interfaceSearchStream<X,
S extends Expression<X>> - Type Parameters:
K
- map key typeV
- map value typeM
- map type- Parameters:
attribute
- associated property- Returns:
- mapped stream
-
mapToExpr
default <Y> ExprValue<Y,Expression<Y>> mapToExpr(Class<Y> type, Function<? super S, ? extends Expression<Y>> exprFunction) Description copied from interface:SearchStream
Map this stream into a stream whose elements are the result of applying the given function.- Specified by:
mapToExpr
in interfaceSearchStream<X,
S extends Expression<X>> - Type Parameters:
Y
- mapped target type- Parameters:
type
- new item typeexprFunction
- function mapping this stream'sSelection
to anExpression
- Returns:
- mapped stream
-
mapToPath
default <Y> PathValue<Y,Path<Y>> mapToPath(Class<Y> type, Function<? super S, ? extends Path<Y>> pathFunction) Description copied from interface:SearchStream
Map this stream into a stream whose elements are the result of applying the given function.- Specified by:
mapToPath
in interfaceSearchStream<X,
S extends Expression<X>> - Type Parameters:
Y
- mapped expresssion type- Parameters:
type
- new item typepathFunction
- function mapping this stream'sSelection
to aPath
- Returns:
- mapped stream
-
mapToFrom
default <Z,Y> FromValue<Y,From<Z, mapToFromY>> (Class<Y> type, Function<? super S, ? extends From<Z, Y>> fromFunction) Description copied from interface:SearchStream
Map this stream into a stream whose elements are the result of applying the given function.- Specified by:
mapToFrom
in interfaceSearchStream<X,
S extends Expression<X>> - Type Parameters:
Z
- mapped source typeY
- mapped target type- Parameters:
type
- new item typefromFunction
- function mapping this stream'sSelection
to aFrom
- Returns:
- mapped stream
-
mapToDouble
Description copied from interface:SearchStream
Map this stream to an associated floating point value.- Specified by:
mapToDouble
in interfaceSearchStream<X,
S extends Expression<X>> - Parameters:
attribute
- associated numerically-valued property- Returns:
- mapped stream of doubles
-
mapToDouble
default DoubleValue mapToDouble(Function<? super S, ? extends Expression<? extends Number>> doubleExprFunction) Description copied from interface:SearchStream
Map this stream into a stream of double values that are the result of applying the given function.- Specified by:
mapToDouble
in interfaceSearchStream<X,
S extends Expression<X>> - Parameters:
doubleExprFunction
- function mapping this stream'sExpression
to a numericalExpression
- Returns:
- mapped stream of doubles
-
mapToLong
Description copied from interface:SearchStream
Map this stream to an associated long value.- Specified by:
mapToLong
in interfaceSearchStream<X,
S extends Expression<X>> - Parameters:
attribute
- associated numerically-valued property- Returns:
- mapped stream of longs
-
mapToLong
default LongValue mapToLong(Function<? super S, ? extends Expression<? extends Number>> longExprFunction) Description copied from interface:SearchStream
Map this stream into a stream of long values that are the result of applying the given function.- Specified by:
mapToLong
in interfaceSearchStream<X,
S extends Expression<X>> - Parameters:
longExprFunction
- function mapping this stream'sExpression
to a numericalExpression
- Returns:
- mapped stream of longs
-
mapToInt
Description copied from interface:SearchStream
Map this stream to an associated integer value.- Specified by:
mapToInt
in interfaceSearchStream<X,
S extends Expression<X>> - Parameters:
attribute
- associated numerically-valued property- Returns:
- mapped stream of integers
-
mapToInt
default IntValue mapToInt(Function<? super S, ? extends Expression<? extends Number>> intExprFunction) Description copied from interface:SearchStream
Map this stream into a stream of integer values that are the result of applying the given function.- Specified by:
mapToInt
in interfaceSearchStream<X,
S extends Expression<X>> - Parameters:
intExprFunction
- function mapping this stream'sExpression
to a numericalExpression
- Returns:
- mapped stream of integers
-
bind
Description copied from interface:QueryStream
Bind an unbound reference to the items in this stream.- Specified by:
bind
in interfaceExprStream<X,
S extends Expression<X>> - Specified by:
bind
in interfaceQueryStream<X,
S extends Expression<X>, AbstractQuery<?>, CriteriaQuery<X>, TypedQuery<X>> - Specified by:
bind
in interfaceSearchStream<X,
S extends Expression<X>> - Specified by:
bind
in interfaceSearchValue<X,
S extends Expression<X>> - Parameters:
ref
- unbound reference- Returns:
- new stream that binds
ref
-
peek
Description copied from interface:QueryStream
Peek at the items in this stream.This is useful in cases where the selection can be modified, e.g., setting join
ON
conditions usingJoin.on()
.- Specified by:
peek
in interfaceExprStream<X,
S extends Expression<X>> - Specified by:
peek
in interfaceQueryStream<X,
S extends Expression<X>, AbstractQuery<?>, CriteriaQuery<X>, TypedQuery<X>> - Specified by:
peek
in interfaceSearchStream<X,
S extends Expression<X>> - Specified by:
peek
in interfaceSearchValue<X,
S extends Expression<X>> - Parameters:
peeker
- peeker into stream- Returns:
- new stream that peeks into this stream
-
bind
<X2,S2 extends Selection<X2>> ExprValue<X,S> bind(Ref<X2, ? super S2> ref, Function<? super S, ? extends S2> refFunction) Description copied from interface:QueryStream
Bind an unbound reference to the result of applying the given function to the items in this stream.- Specified by:
bind
in interfaceExprStream<X,
S extends Expression<X>> - Specified by:
bind
in interfaceQueryStream<X,
S extends Expression<X>, AbstractQuery<?>, CriteriaQuery<X>, TypedQuery<X>> - Specified by:
bind
in interfaceSearchStream<X,
S extends Expression<X>> - Specified by:
bind
in interfaceSearchValue<X,
S extends Expression<X>> - Type Parameters:
X2
- type of the bound valueS2
- criteria type of the bound value- Parameters:
ref
- unbound referencerefFunction
- function mapping this stream'sSelection
to the reference value- Returns:
- new stream that binds
ref
-
filter
Description copied from interface:QueryStream
Filter results using the specified boolean property.Adds to any previously specified filters.
- Specified by:
filter
in interfaceExprStream<X,
S extends Expression<X>> - Specified by:
filter
in interfaceQueryStream<X,
S extends Expression<X>, AbstractQuery<?>, CriteriaQuery<X>, TypedQuery<X>> - Specified by:
filter
in interfaceSearchStream<X,
S extends Expression<X>> - Specified by:
filter
in interfaceSearchValue<X,
S extends Expression<X>> - Parameters:
attribute
- boolean property- Returns:
- new filtered stream
-
filter
Description copied from interface:QueryStream
Filter results using the boolean expression produced by the given function.Adds to any previously specified filters.
- Specified by:
filter
in interfaceExprStream<X,
S extends Expression<X>> - Specified by:
filter
in interfaceQueryStream<X,
S extends Expression<X>, AbstractQuery<?>, CriteriaQuery<X>, TypedQuery<X>> - Specified by:
filter
in interfaceSearchStream<X,
S extends Expression<X>> - Specified by:
filter
in interfaceSearchValue<X,
S extends Expression<X>> - Parameters:
predicateBuilder
- function mapping this stream's item to a booleanExpression
- Returns:
- new filtered stream
-
withFlushMode
Description copied from interface:QueryStream
Set theFlushModeType
associated with this query.- Specified by:
withFlushMode
in interfaceExprStream<X,
S extends Expression<X>> - Specified by:
withFlushMode
in interfaceQueryStream<X,
S extends Expression<X>, AbstractQuery<?>, CriteriaQuery<X>, TypedQuery<X>> - Specified by:
withFlushMode
in interfaceSearchStream<X,
S extends Expression<X>> - Specified by:
withFlushMode
in interfaceSearchValue<X,
S extends Expression<X>> - Parameters:
flushMode
- new flush mode- Returns:
- new stream with the specified flush mode configured
- See Also:
-
withLockMode
Description copied from interface:QueryStream
Set theLockModeType
associated with this query.- Specified by:
withLockMode
in interfaceExprStream<X,
S extends Expression<X>> - Specified by:
withLockMode
in interfaceQueryStream<X,
S extends Expression<X>, AbstractQuery<?>, CriteriaQuery<X>, TypedQuery<X>> - Specified by:
withLockMode
in interfaceSearchStream<X,
S extends Expression<X>> - Specified by:
withLockMode
in interfaceSearchValue<X,
S extends Expression<X>> - Parameters:
lockMode
- new lock mode- Returns:
- new stream with the specified lock mode configured
- See Also:
-
withHint
Description copied from interface:QueryStream
Associate a hint with this query.- Specified by:
withHint
in interfaceExprStream<X,
S extends Expression<X>> - Specified by:
withHint
in interfaceQueryStream<X,
S extends Expression<X>, AbstractQuery<?>, CriteriaQuery<X>, TypedQuery<X>> - Specified by:
withHint
in interfaceSearchStream<X,
S extends Expression<X>> - Specified by:
withHint
in interfaceSearchValue<X,
S extends Expression<X>> - Parameters:
name
- name of hintvalue
- value of hint- Returns:
- new stream with the specified hint configured
- See Also:
-
withHints
Description copied from interface:QueryStream
Associate hints with this query.- Specified by:
withHints
in interfaceExprStream<X,
S extends Expression<X>> - Specified by:
withHints
in interfaceQueryStream<X,
S extends Expression<X>, AbstractQuery<?>, CriteriaQuery<X>, TypedQuery<X>> - Specified by:
withHints
in interfaceSearchStream<X,
S extends Expression<X>> - Specified by:
withHints
in interfaceSearchValue<X,
S extends Expression<X>> - Parameters:
hints
- hints to add- Returns:
- new stream with the specified hints added
- See Also:
-
withParam
Description copied from interface:QueryStream
Bind the value of a query parameter.Replaces any previous binding of the same parameter.
- Specified by:
withParam
in interfaceExprStream<X,
S extends Expression<X>> - Specified by:
withParam
in interfaceQueryStream<X,
S extends Expression<X>, AbstractQuery<?>, CriteriaQuery<X>, TypedQuery<X>> - Specified by:
withParam
in interfaceSearchStream<X,
S extends Expression<X>> - Specified by:
withParam
in interfaceSearchValue<X,
S extends Expression<X>> - Type Parameters:
T
- parameter value type- Parameters:
parameter
- the parameter to setvalue
- parameter value- Returns:
- new stream with the specified parameter value set
- See Also:
-
withParam
Description copied from interface:QueryStream
Bind the value of a query parameter of typeDate
.Replaces any previous binding of the same parameter.
- Specified by:
withParam
in interfaceExprStream<X,
S extends Expression<X>> - Specified by:
withParam
in interfaceQueryStream<X,
S extends Expression<X>, AbstractQuery<?>, CriteriaQuery<X>, TypedQuery<X>> - Specified by:
withParam
in interfaceSearchStream<X,
S extends Expression<X>> - Specified by:
withParam
in interfaceSearchValue<X,
S extends Expression<X>> - Parameters:
parameter
- the parameter to setvalue
- parameter valuetemporalType
- temporal type forvalue
- Returns:
- new stream with the specified parameter value set
- See Also:
-
withParam
Description copied from interface:QueryStream
Bind the value of a query parameter of typeCalendar
.Replaces any previous binding of the same parameter.
- Specified by:
withParam
in interfaceExprStream<X,
S extends Expression<X>> - Specified by:
withParam
in interfaceQueryStream<X,
S extends Expression<X>, AbstractQuery<?>, CriteriaQuery<X>, TypedQuery<X>> - Specified by:
withParam
in interfaceSearchStream<X,
S extends Expression<X>> - Specified by:
withParam
in interfaceSearchValue<X,
S extends Expression<X>> - Parameters:
parameter
- the parameter to setvalue
- parameter valuetemporalType
- temporal type forvalue
- Returns:
- new stream with the specified parameter value set
- See Also:
-
withParams
Description copied from interface:QueryStream
Associate parameter bindings with this query.Replaces any previous bindings of the same parameters.
- Specified by:
withParams
in interfaceExprStream<X,
S extends Expression<X>> - Specified by:
withParams
in interfaceQueryStream<X,
S extends Expression<X>, AbstractQuery<?>, CriteriaQuery<X>, TypedQuery<X>> - Specified by:
withParams
in interfaceSearchStream<X,
S extends Expression<X>> - Specified by:
withParams
in interfaceSearchValue<X,
S extends Expression<X>> - Parameters:
params
- bindings to add- Returns:
- new stream with the specified parameter bindings added
- See Also:
-
withLoadGraph
Description copied from interface:QueryStream
Configure a load graph for this query.Equivalent to
withHint
("jakarta.persistence.loadgraph", name)
.- Specified by:
withLoadGraph
in interfaceExprStream<X,
S extends Expression<X>> - Specified by:
withLoadGraph
in interfaceQueryStream<X,
S extends Expression<X>, AbstractQuery<?>, CriteriaQuery<X>, TypedQuery<X>> - Specified by:
withLoadGraph
in interfaceSearchStream<X,
S extends Expression<X>> - Specified by:
withLoadGraph
in interfaceSearchValue<X,
S extends Expression<X>> - Parameters:
name
- name of load graph- Returns:
- new stream with the specified load graph configured
-
withFetchGraph
Description copied from interface:QueryStream
Configure a fetch graph for this query.Equivalent to
withHint
("jakarta.persistence.fetchgraph", name)
.- Specified by:
withFetchGraph
in interfaceExprStream<X,
S extends Expression<X>> - Specified by:
withFetchGraph
in interfaceQueryStream<X,
S extends Expression<X>, AbstractQuery<?>, CriteriaQuery<X>, TypedQuery<X>> - Specified by:
withFetchGraph
in interfaceSearchStream<X,
S extends Expression<X>> - Specified by:
withFetchGraph
in interfaceSearchValue<X,
S extends Expression<X>> - Parameters:
name
- name of fetch graph- Returns:
- new stream with the specified fetch graph configured
-