Package com.sap.cds
Interface Result
- All Superinterfaces:
Iterable<Row>,JSONizable
Represents the result data returned by the
CdsDataStore.
Result can be serialized to JSON and accessed as an Iterable
of Map or in a typed way via an accessor interface.-
Method Summary
Modifier and TypeMethodDescriptionintReturns the number of batches.first()Returns the first row.<T> Optional<T>Returns the first row mapped to the giventype.longReturns the total number of root entities matching the query as requested bySelect.inlineCount().list()Returns a list of the result rows.<T> List<T>Returns a list of the result rows mapped to the giventype.longrowCount()Returns the number of rows affected or returned by the query.longrowCount(int batch) Returns the number of rows affected or returned by the query with the given batch index.rowType()Returns the row type of this result.single()Returns the single row.<T> TReturns the single row mapped to the giventype.stream()Returns a sequentialStreamof the result rows.<T> Stream<T>Returns a sequentialStreamof the result rows mapped to the giventype.Methods inherited from interface java.lang.Iterable
forEach, iterator, spliteratorMethods inherited from interface com.sap.cds.JSONizable
toJson
-
Method Details
-
single
Row single()Returns the single row.- Returns:
- a
Row - Throws:
EmptyResultException- if the result is emptyNonUniqueResultException- if the result contains more than one row
-
single
Returns the single row mapped to the giventype.- Type Parameters:
T- the return type- Parameters:
type- the type the row is mapped to- Returns:
- a row mapped to
T - Throws:
EmptyResultException- if the result is emptyNonUniqueResultException- if the result contains more than one row
-
first
Returns the first row.- Returns:
- an optional
Row
-
first
Returns the first row mapped to the giventype.- Type Parameters:
T- the type of theOptional- Parameters:
type- the type the row is mapped to- Returns:
- an
Optionalrow mapped toT
-
stream
Returns a sequentialStreamof the result rows.- Returns:
- a
Streamof rows
-
streamOf
Returns a sequentialStreamof the result rows mapped to the giventype.- Type Parameters:
T- the type of theStream- Parameters:
type- the type the result rows are mapped to- Returns:
- a
Streamof the giventype
-
list
Returns a list of the result rows.- Returns:
- a list of
Row
-
listOf
Returns a list of the result rows mapped to the giventype.- Type Parameters:
T- the type of theList- Parameters:
type- the type the result rows are mapped to- Returns:
- a list of the given
type
-
rowType
CdsStructuredType rowType()Returns the row type of this result.- Returns:
- the row type
-
rowCount
long rowCount()Returns the number of rows affected or returned by the query. In case of a batch query the sum over all batch row counts.- Returns:
- the row count, -1 if undefined
-
rowCount
long rowCount(int batch) Returns the number of rows affected or returned by the query with the given batch index.- Parameters:
batch- the batch index- Returns:
- the row count of the batch, -1 if undefined
- Throws:
IndexOutOfBoundsException- if the batch index is out of range
-
batchCount
int batchCount()Returns the number of batches.- Returns:
- the number of batches, -1 if undefined
-
inlineCount
long inlineCount()Returns the total number of root entities matching the query as requested bySelect.inlineCount().- Returns:
- the row count, -1 if undefined
-