FluentHelperT
- The fluent helper type.ObjectT
- The type of the object this OData request operates on, if any.ResultT
- The type of the result entity, if any.public abstract class FluentHelperFunction<FluentHelperT,ObjectT,ResultT> extends FluentHelperBasic<FluentHelperT,ObjectT,ResultT>
executing
it.Constructor and Description |
---|
FluentHelperFunction(String servicePath)
Instantiates this fluent helper using the given service path to send the requests.
|
Modifier and Type | Method and Description |
---|---|
protected abstract org.apache.http.client.methods.HttpUriRequest |
createRequest(URI uri)
Creates a request for this function based on the given
URI . |
protected List<ObjectT> |
executeMultiple(HttpDestinationProperties destination)
Default implementation for the case that this function returns a collection of entries.
|
protected ObjectT |
executeSingle(HttpDestinationProperties destination)
Default implementation for the case that this function returns a single type.
|
protected abstract String |
getFunctionName()
The exact name of the function to be called on the OData Endpoint.
|
protected String |
getJsonResponseObjectName()
Deprecated.
In order to customize JSON response parsing, use
refineJsonResponse(com.google.gson.JsonElement) instead. |
protected abstract Map<String,Object> |
getParameters()
Getter for the map of parameters to be used in the function call.
|
protected com.google.gson.JsonElement |
refineJsonResponse(com.google.gson.JsonElement jsonElement)
Transform the JSON element from the response to extract a result entity.
|
cachingMetadata, execute, getEntityClass, getHeadersForRequestAndImplicitRequests, getHeadersForRequestOnly, getParametersForRequestOnly, getServicePath, getThis, getVersionIdentifier, isCachingMetadata, withHeader, withHeaders, withoutCachingMetadata, withQueryParameter
@Nonnull protected abstract Map<String,Object> getParameters()
The map maps the ODataName of a parameter to the corresponding value.
@Nonnull protected abstract String getFunctionName()
@Nonnull protected abstract org.apache.http.client.methods.HttpUriRequest createRequest(@Nonnull URI uri)
URI
.
Examples for such requests are HttpGet
and HttpPost
.
uri
- The URI
the request should target.@Nullable protected ObjectT executeSingle(@Nonnull HttpDestinationProperties destination) throws com.sap.cloud.sdk.odatav2.connectivity.ODataException
This method can be used in subclasses to implement the FluentHelperBasic.execute(HttpDestinationProperties)
method.
destination
- The destination to run the function against.null
if the function did not return a
result.com.sap.cloud.sdk.odatav2.connectivity.ODataException
- If the execution of the function failed.@Nonnull protected List<ObjectT> executeMultiple(@Nonnull HttpDestinationProperties destination) throws com.sap.cloud.sdk.odatav2.connectivity.ODataException
This method can be used in subclasses to implement the FluentHelperBasic.execute(HttpDestinationProperties)
method.
destination
- The destination to run the function against.com.sap.cloud.sdk.odatav2.connectivity.ODataException
- If the execution of the function failed.@Deprecated @Nonnull protected String getJsonResponseObjectName()
refineJsonResponse(com.google.gson.JsonElement)
instead.@Nullable protected com.google.gson.JsonElement refineJsonResponse(@Nullable com.google.gson.JsonElement jsonElement)
jsonElement
- The optional response JSON elementCopyright © 2019 SAP SE. All rights reserved.