public class ProductFetchRequest extends java.lang.Object implements FetchRequest<Product>
BackendProductProjection
to Product
.Constructor and Description |
---|
ProductFetchRequest(FetchRequest<BackendProductProjection> underlyingRequest,
CategoryTree categoryTree) |
Modifier and Type | Method and Description |
---|---|
ProductFetchRequest |
expand(java.lang.String... paths)
Requests Reference fields to be expanded in the returned objects.
|
com.google.common.base.Optional<Product> |
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<Product>> |
fetchAsync()
Executes the request asynchronously and returns a future
providing the result, or
absent if not found. |
FetchRequest<BackendProductProjection> |
getUnderlyingRequest() |
java.lang.String |
toString() |
public ProductFetchRequest(@Nonnull FetchRequest<BackendProductProjection> underlyingRequest, CategoryTree categoryTree)
public com.google.common.base.Optional<Product> fetch()
FetchRequest
absent
if the object was not found.fetch
in interface FetchRequest<Product>
public com.google.common.util.concurrent.ListenableFuture<com.google.common.base.Optional<Product>> fetchAsync()
FetchRequest
absent
if not found.fetchAsync
in interface FetchRequest<Product>
public ProductFetchRequest 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<Product>
paths
- The paths to be expanded, such as 'customerGroup'public FetchRequest<BackendProductProjection> getUnderlyingRequest()
public java.lang.String toString()
toString
in class java.lang.Object