E
- the type of value yielded by this execution context, as determined by which Select
factory
method was used to begin the query. For example, Select.from(String)
yields GenericValue
and Select.id()
yields Long
.public static interface SelectQuery.ExecutionContext<E>
Select
queries that is available after calling
Select.ExecutableContext.runWith(EntityEngine)
or
Select.ExecutableContext.runWith(com.atlassian.jira.ofbiz.OfBizDelegator)
.
The methods available through the execution context specify how the selected entities should be returned
to the caller. For example, asList()
will return a list of values, or count()
will return
only a count of them.
Modifier and Type | Method and Description |
---|---|
List<E> |
asList()
Returns the selected values in a list.
|
<R> List<R> |
asList(Function<E,R> mappingFunction)
Returns the selected values in a list with the mapping function applied to each of them.
|
<R> R |
consumeWith(EntityListConsumer<E,R> consumer)
Apply an
EntityListConsumer to the returned results. |
long |
count()
Returns a count of matching items.
|
E |
singleValue()
Returns the single Entity that is the result of this query.
|
void |
visitWith(Visitor<E> visitor)
Visits each entity returned by the query.
|
@Nonnull List<E> asList()
@Nonnull <R> List<R> asList(@Nonnull Function<E,R> mappingFunction)
mappingFunction
is a Function<GenericValue,String>
, then each value is returned
as the String
produced by the function instead of the GenericValue
itself.R
- the type of value returned by the mapping function@Nullable E singleValue()
Will return null
if no rows were returned by the DB query.
null
if no match is found.IllegalStateException
- if more than one row is found.<R> R consumeWith(@Nonnull EntityListConsumer<E,R> consumer)
EntityListConsumer
to the returned results.
This is equivalent to calling visitWith(Visitor)
, except that the entity list consumer can
return a value.
R
- the return value of the consumerconsumer
- the entity list consumer that will consume the query resultsEntityListConsumer.result()
method.void visitWith(@Nonnull Visitor<E> visitor)
This is equivalent to calling consumeWith(EntityListConsumer)
and ignoring the return value.
visitor
- the visitor to call with each entity that the query returnslong count()
entityName + "Count"
pseudo-view stuff in the entity model, but rather generates
a count function directly in the query that it executes, so you should be able to use it with
arbitrary entities.Copyright © 2002-2015 Atlassian. All Rights Reserved.