If you look at the result type of the query method in RestAPIFacade
, you'll see that it returns a QueryResult<T>
on QueryResult you have a bunch of methods to convert your result to other types, and these methods then use the result-converter to do the conversion.
public interface QueryResult<T> extends Iterable<T> {
<R> ConvertedResult<R> to(Class<R> type);
<R> ConvertedResult<R> to(Class<R> type, ResultConverter<T, R> resultConverter);
void handle(Handler<T> handler);
}
Where the to
methods return a ConvertedResult
which then is either an Iterable of type R or has methods to access a single value of type R.
public interface ConvertedResult<R> extends Iterable<R> {
R single();
R singleOrNull();
void handle(Handler<R> handler);
}
So in this case T
is Map<String, Object>
and R
would be your target type. The default Converter supports conversion to node and path objects and vice versa. See the implementation here.