public class FetchRequestAdapter<T> extends java.lang.Object implements FetchRequest<T>
Constructor and Description |
---|
FetchRequestAdapter(FetchRequest<T> request) |
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. |
play.libs.F.Promise<com.google.common.base.Optional<T>> |
fetchAsync()
Executes the request asynchronously and returns a future
providing the result, or
absent if not found. |
public FetchRequestAdapter(@Nonnull FetchRequest<T> request)
public com.google.common.base.Optional<T> fetch()
FetchRequest
absent
if the object was not found.fetch
in interface FetchRequest<T>
public play.libs.F.Promise<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'.