public class FetchRequestImpl<T> extends java.lang.Object implements FetchRequest<T>, TestableRequest
Constructor and Description |
---|
FetchRequestImpl(RequestHolder<T> requestHolder,
org.codehaus.jackson.type.TypeReference<T> jsonParserTypeRef) |
Modifier and Type | Method and Description |
---|---|
FetchRequest<T> |
expand(java.lang.String... paths)
Requests Reference fields to be expanded in the returned objects.
|
com.google.common.base.Optional<T> |
fetch()
Executes the request and returns the result, or
absent if the object was not found. |
com.google.common.util.concurrent.ListenableFuture<com.google.common.base.Optional<T>> |
fetchAsync()
Executes the request asynchronously and returns a future
providing the result, or
absent if not found. |
TestableRequestHolder |
getRequestHolder()
Returns the internal request holder, for testing purposes.
|
java.lang.String |
toString() |
public FetchRequestImpl(RequestHolder<T> requestHolder, org.codehaus.jackson.type.TypeReference<T> jsonParserTypeRef)
public com.google.common.base.Optional<T> fetch()
FetchRequest
absent
if the object was not found.fetch
in interface FetchRequest<T>
public com.google.common.util.concurrent.ListenableFuture<com.google.common.base.Optional<T>> fetchAsync()
FetchRequest
absent
if not found.fetchAsync
in interface FetchRequest<T>
public FetchRequest<T> expand(java.lang.String... paths)
FetchRequest
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 FetchRequest<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