Class DefaultBatchResponseResult
java.lang.Object
com.sap.cloud.sdk.datamodel.odata.helper.batch.DefaultBatchResponseResult
- All Implemented Interfaces:
BatchResponse
,AutoCloseable
Generic OData service response wrapper for Batch response.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes the underlying HTTP response entity.io.vavr.control.Try<BatchResponseChangeSet>
get
(int index) Get the result for a single changeset.<ResultT> List<ResultT>
getReadResult
(CollectionValuedFluentHelperFunction<?, ResultT, ?> helper) Convenience method to get the result for a function import request that returns a collection of primitive values or entities on the OData batch response.<EntityT extends VdmEntity<?>>
EntityTgetReadResult
(FluentHelperByKey<?, EntityT, ?> helper) Convenience method to get the result for a read-by-key request on the OData batch response.getReadResult
(FluentHelperRead<?, EntityT, ?> helper) Convenience method to get the result for a read request on the OData batch response.<ResultT> ResultT
getReadResult
(SingleValuedFluentHelperFunction<?, ResultT, ?> helper) Convenience method to get the result for a function import request that returns a single primitive value or entity on the OData batch response.static DefaultBatchResponseResult
of
(ODataRequestResultMultipartGeneric response, BatchFluentHelperBasic<?, ?> initialRequest) Static factory method to convert from generic response to typed response.
-
Method Details
-
of
@Nonnull public static DefaultBatchResponseResult of(@Nonnull ODataRequestResultMultipartGeneric response, @Nonnull BatchFluentHelperBasic<?, ?> initialRequest) Static factory method to convert from generic response to typed response.- Parameters:
response
- The generic response that should be converted.initialRequest
- The initial BatchRequest- Returns:
- The typed (high-level) BatchResponse object.
-
get
Description copied from interface:BatchResponse
Get the result for a single changeset.- Specified by:
get
in interfaceBatchResponse
- Parameters:
index
- The zero-based index of the selected changeset.- Returns:
- A wrapper of the changeset result. It can be checked for errors upon evaluation.
-
getReadResult
@Nonnull public <EntityT extends VdmEntity<?>> List<EntityT> getReadResult(@Nonnull FluentHelperRead<?, EntityT, ?> helper) Description copied from interface:BatchResponse
Convenience method to get the result for a read request on the OData batch response.- Specified by:
getReadResult
in interfaceBatchResponse
- Type Parameters:
EntityT
- The generic entity type.- Parameters:
helper
- The original fluent helper instance that was used to create the request.- Returns:
- A list of entities according to the original request.
-
getReadResult
@Nonnull public <EntityT extends VdmEntity<?>> EntityT getReadResult(@Nonnull FluentHelperByKey<?, EntityT, ?> helper) Description copied from interface:BatchResponse
Convenience method to get the result for a read-by-key request on the OData batch response.- Specified by:
getReadResult
in interfaceBatchResponse
- Type Parameters:
EntityT
- The generic entity type.- Parameters:
helper
- The original fluent helper instance that was used to create the request.- Returns:
- A single entity according to the original request.
-
getReadResult
@Nonnull public <ResultT> ResultT getReadResult(@Nonnull SingleValuedFluentHelperFunction<?, ResultT, ?> helper) Description copied from interface:BatchResponse
Convenience method to get the result for a function import request that returns a single primitive value or entity on the OData batch response.- Specified by:
getReadResult
in interfaceBatchResponse
- Type Parameters:
ResultT
- The result type of the function import request- Parameters:
helper
- The original fluent helper instance that was used to create the request.- Returns:
- A single primitive value or entity according to the original request
-
getReadResult
@Nonnull public <ResultT> List<ResultT> getReadResult(@Nonnull CollectionValuedFluentHelperFunction<?, ResultT, ?> helper) Description copied from interface:BatchResponse
Convenience method to get the result for a function import request that returns a collection of primitive values or entities on the OData batch response.- Specified by:
getReadResult
in interfaceBatchResponse
- Type Parameters:
ResultT
- The result type of the function import request- Parameters:
helper
- The original fluent helper instance that was used to create the request.- Returns:
- A collection of primitive values or entities according to the original request
-
close
public void close()Closes the underlying HTTP response entity.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceBatchResponse
- Since:
- 4.15.0
-