Interface QueryResultConverter<T, R extends @Nullable Object>
- Type Parameters:
T- object type accepted by this converter.R- the returned result type.
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Converter for Cassandra query results.
This is a functional interface that allows for mapping a Row to a result type.
row mapping can obtain upstream a upstream converter to enrich the final result object. This is useful when e.g. wrapping result objects where the
wrapper needs to obtain information from the actual Row.
- Since:
- 5.0
- Author:
- Mark Paluch
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA supplier that converts aRowintoT. -
Method Summary
Modifier and TypeMethodDescriptiondefault <V> QueryResultConverter<T, V> andThen(QueryResultConverter<? super R, ? extends V> after) Returns a composed function that first applies this function to its input, and then applies theafterfunction to the result.static <T> QueryResultConverter<T, T> entity()Returns a function that returns the materialized entity.mapRow(com.datastax.oss.driver.api.core.cql.Row row, QueryResultConverter.ConversionResultSupplier<T> reader) Map aRowthat is read from the Cassandra database to a query result.
-
Method Details
-
entity
Returns a function that returns the materialized entity.- Type Parameters:
T- the type of the input and output entity to the function.- Returns:
- a function that returns the materialized entity.
-
mapRow
R mapRow(com.datastax.oss.driver.api.core.cql.Row row, QueryResultConverter.ConversionResultSupplier<T> reader) Map aRowthat is read from the Cassandra database to a query result.- Parameters:
row- the raw row from the Cassandra result.reader- reader object that supplies an upstream result from an earlier converter.- Returns:
- the mapped result.
-
andThen
Returns a composed function that first applies this function to its input, and then applies theafterfunction to the result. If evaluation of either function throws an exception, it is relayed to the caller of the composed function.- Type Parameters:
V- the type of output of theafterfunction, and of the composed function.- Parameters:
after- the function to apply after this function is applied.- Returns:
- a composed function that first applies this function and then applies the
afterfunction.
-