public abstract class QueryRequestMapping<A,B> extends java.lang.Object implements QueryRequest<B>
QueryRequest<A>
in a QueryRequest<B>
.Modifier | Constructor and Description |
---|---|
protected |
QueryRequestMapping(QueryRequest<A> delegate) |
Modifier and Type | Method and Description |
---|---|
protected abstract B |
convert(A a)
Override this method to convert elements from A to B.
|
QueryRequest<B> |
expand(java.lang.String... paths)
Requests Reference fields to be expanded in the returned objects.
|
QueryResult<B> |
fetch()
Executes the request and returns the result.
|
com.google.common.util.concurrent.ListenableFuture<QueryResult<B>> |
fetchAsync()
Executes the request asynchronously and returns a future providing the result.
|
QueryRequest<B> |
page(int page)
Sets the page number for paging through results.
|
QueryRequest<B> |
pageSize(int pageSize)
Sets the size of a page for paging through results.
|
QueryRequest<B> |
sort(java.lang.String fieldName,
SortDirection sortDirection)
Sets the sort expression for sorting the result.
|
QueryRequest<B> |
where(java.lang.String predicate)
Sets the predicate used to filter the results for this query request.
|
protected QueryRequestMapping(QueryRequest<A> delegate)
public final QueryResult<B> fetch()
QueryRequest
fetch
in interface QueryRequest<B>
public com.google.common.util.concurrent.ListenableFuture<QueryResult<B>> fetchAsync()
QueryRequest
fetchAsync
in interface QueryRequest<B>
protected abstract B convert(A a)
a
- The single element that should be converted to B.public QueryRequest<B> where(java.lang.String predicate)
QueryRequest
where
in interface QueryRequest<B>
predicate
- The predicate which is used to filter the results.
Example: "name(en=\"myName\")".
public QueryRequest<B> sort(java.lang.String fieldName, SortDirection sortDirection)
QueryRequest
sort
in interface QueryRequest<B>
fieldName
- the attribute to sort with
Example: "name.en".
sortDirection
- The direction to sort with.public QueryRequest<B> page(int page)
QueryRequest
page
in interface QueryRequest<B>
public QueryRequest<B> pageSize(int pageSize)
QueryRequest
pageSize
in interface QueryRequest<B>
public QueryRequest<B> expand(java.lang.String... paths)
QueryRequest
As an illustration, here is how reference expansion looks at the underlying JSON transport level. Given a customer object:
{
"name": "John Doe"
"customerGroup": {
"typeId": "customer-group",
"id": "7ba61480-6a72-4a2a-a72e-cd39f75a7ef2"
}
}
This is what the result looks like when the path 'customerGroup' has been expanded:
{
"name": "John Doe"
"customerGroup": {
typeId: "customer-group",
id: "7ba61480-6a72-4a2a-a72e-cd39f75a7ef2"
obj: {
"name": "Gold"
}
}
}
expand
in interface QueryRequest<B>
paths
- The paths to be expanded, such as 'customerGroup'.