public class QueryRequestImpl<T> extends java.lang.Object implements QueryRequest<T>, TestableRequest
Constructor and Description |
---|
QueryRequestImpl(RequestHolder<QueryResult<T>> requestHolder,
org.codehaus.jackson.type.TypeReference<QueryResult<T>> jsonParserTypeRef) |
Modifier and Type | Method and Description |
---|---|
QueryRequest<T> |
expand(java.lang.String... paths)
Requests Reference fields to be expanded in the returned objects.
|
QueryResult<T> |
fetch()
Executes the request and returns the result.
|
com.google.common.util.concurrent.ListenableFuture<QueryResult<T>> |
fetchAsync()
Executes the request asynchronously and returns a future providing the result.
|
TestableRequestHolder |
getRequestHolder()
Returns the internal request holder, for testing purposes.
|
QueryRequest<T> |
page(int page)
Sets the page number for paging through results.
|
QueryRequest<T> |
pageSize(int pageSize)
Sets the size of a page for paging through results.
|
QueryRequest<T> |
sort(java.lang.String fieldName,
SortDirection sortDirection)
Sets the sort expression for sorting the result.
|
java.lang.String |
toString() |
QueryRequest<T> |
where(java.lang.String predicate)
Sets the predicate used to filter the results for this query request.
|
public QueryRequestImpl(RequestHolder<QueryResult<T>> requestHolder, org.codehaus.jackson.type.TypeReference<QueryResult<T>> jsonParserTypeRef)
public QueryRequest<T> where(java.lang.String predicate)
QueryRequest
where
in interface QueryRequest<T>
predicate
- The predicate which is used to filter the results.
Example: "name(en=\"myName\")".
public QueryRequest<T> sort(java.lang.String fieldName, SortDirection sortDirection)
QueryRequest
sort
in interface QueryRequest<T>
fieldName
- the attribute to sort with
Example: "name.en".
sortDirection
- The direction to sort with.public QueryRequest<T> page(int page)
QueryRequest
page
in interface QueryRequest<T>
public QueryRequest<T> pageSize(int pageSize)
QueryRequest
pageSize
in interface QueryRequest<T>
public QueryResult<T> fetch()
QueryRequest
fetch
in interface QueryRequest<T>
public com.google.common.util.concurrent.ListenableFuture<QueryResult<T>> fetchAsync()
QueryRequest
fetchAsync
in interface QueryRequest<T>
public QueryRequest<T> 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<T>
paths
- The paths to be expanded, such as 'customerGroup'.public TestableRequestHolder getRequestHolder()
TestableRequest
getRequestHolder
in interface TestableRequest
public java.lang.String toString()
toString
in class java.lang.Object