@Beta public class ODataRequestResultGeneric extends Object implements ODataRequestResult, ODataRequestResultDeserializable, ODataRequestResultPagination
Constructor and Description |
---|
ODataRequestResultGeneric(ODataRequestGeneric oDataRequest,
org.apache.http.HttpResponse httpResponse)
Default constructor.
|
ODataRequestResultGeneric(ODataRequestGeneric oDataRequest,
org.apache.http.HttpResponse httpResponse,
org.apache.http.client.HttpClient httpClient)
Default constructor with enabled pagination.
|
Modifier and Type | Method and Description |
---|---|
<T> T |
as(Class<T> objectType)
Converts ODataRequestResult into POJO.
|
<T> T |
as(Class<T> objectType,
Function<com.google.gson.JsonElement,com.google.gson.JsonElement> resultExtractor)
Converts ODataRequestResult into a POJO based on a function extracting the relevant JSON response object.
|
<T> List<T> |
asList(Class<T> objectType)
Converts ODataRequestResult into list of POJOs.
|
List<Map<String,Object>> |
asListOfMaps()
Construct and get a list of key-value maps from the OData response.
|
Map<String,Object> |
asMap()
Construct and get a key-value map from the OData response.
|
protected boolean |
canEqual(Object other) |
void |
disableBufferingHttpResponse()
Method that allows consumers to disable buffering HTTP response entity.
|
boolean |
equals(Object o) |
Iterable<String> |
getHeaderNames()
Get the iterable list of HTTP response header names.
|
Iterable<String> |
getHeaderValues(String headerName)
Get the iterable HTTP header values for a specific header name.
|
org.apache.http.HttpResponse |
getHttpResponse()
Method that creates a
BufferedHttpEntity from the HttpEntity if buffering the HTTP response is
not turned off by using disableBufferingHttpResponse() |
long |
getInlineCount()
Get the count of elements in the result set.
|
io.vavr.control.Option<String> |
getNextLink()
Get the next page link of result-set.
|
ODataRequestGeneric |
getODataRequest()
Get the original
ODataRequestExecutable instance that was used for running the OData request. |
protected Map<String,Iterable<String>> |
getResponseHeaders()
Get the original map of HTTP response header key-values.
|
io.vavr.control.Option<String> |
getVersionIdentifierFromHeader()
Try to extract a version identifier from the ETag header.
|
int |
hashCode() |
boolean |
hasPayload()
Check whether or not the HttpResponse contains (potentially empty) payload.
|
Iterator<ResultElement> |
iterator() |
void |
streamElements(Consumer<ResultElement> handler)
Run a consumer for fluent API type ResultElement to iterate over the OData response with a continuous data
stream.
|
io.vavr.control.Try<ODataRequestResultGeneric> |
tryGetNextPage()
Get the next page link of result-set.
|
ODataRequestResultGeneric |
withNumberDeserializationStrategy(NumberDeserializationStrategy numberStrategy)
Set the default number deserialization strategy for generic JSON numbers without target type mapping.
|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
iteratePages
forEach, spliterator
public ODataRequestResultGeneric(@Nonnull ODataRequestGeneric oDataRequest, @Nonnull org.apache.http.HttpResponse httpResponse)
oDataRequest
- The original OData requesthttpResponse
- The original Http responsepublic ODataRequestResultGeneric(@Nonnull ODataRequestGeneric oDataRequest, @Nonnull org.apache.http.HttpResponse httpResponse, @Nullable org.apache.http.client.HttpClient httpClient)
oDataRequest
- The original OData requesthttpResponse
- The original Http responsehttpClient
- The original Http client@Nonnull public ODataRequestResultGeneric withNumberDeserializationStrategy(@Nonnull NumberDeserializationStrategy numberStrategy)
numberStrategy
- The number deserialization strategy to use.ODataRequestGeneric
.@Nonnull protected Map<String,Iterable<String>> getResponseHeaders()
public void disableBufferingHttpResponse()
@Nonnull public org.apache.http.HttpResponse getHttpResponse()
BufferedHttpEntity
from the HttpEntity
if buffering the HTTP response is
not turned off by using disableBufferingHttpResponse()
getHttpResponse
in interface ODataRequestResult
public void streamElements(@Nonnull Consumer<ResultElement> handler)
streamElements
in interface ODataRequestResultDeserializable
handler
- The consumer for generic ResultElement.@Nonnull public io.vavr.control.Option<String> getVersionIdentifierFromHeader()
Option.None
, if none was found.@Nonnull public Iterator<ResultElement> iterator()
iterator
in interface Iterable<ResultElement>
@Nonnull public <T> T as(@Nonnull Class<T> objectType)
ODataRequestResultDeserializable
as
in interface ODataRequestResultDeserializable
T
- The generic type of POJOobjectType
- type of POJO@Nonnull public <T> T as(@Nonnull Class<T> objectType, @Nonnull Function<com.google.gson.JsonElement,com.google.gson.JsonElement> resultExtractor)
T
- The generic type of POJOobjectType
- type of POJOresultExtractor
- A function extracting the relevant result object of the JSON root object. In case of OData V2 the
"d"
object is treated as the root object. Pass Function.identity()
in case no
transformation should take place.ODataResponseException
- When the HTTP status indicates an erroneous response.ODataDeserializationException
- When deserialization process failed for the OData response object.@Nonnull public <T> List<T> asList(@Nonnull Class<T> objectType)
ODataRequestResultDeserializable
asList
in interface ODataRequestResultDeserializable
T
- Generic type of the POJOobjectType
- type of POJOpublic long getInlineCount()
ODataRequestResultDeserializable
getInlineCount
in interface ODataRequestResultDeserializable
@Nonnull public io.vavr.control.Option<String> getNextLink()
ODataRequestResultPagination
getNextLink
in interface ODataRequestResultPagination
null
if last page of result-set.@Nonnull public Map<String,Object> asMap()
ODataRequestResultDeserializable
asMap
in interface ODataRequestResultDeserializable
@Nonnull public List<Map<String,Object>> asListOfMaps()
ODataRequestResultDeserializable
asListOfMaps
in interface ODataRequestResultDeserializable
@Nonnull public Iterable<String> getHeaderValues(@Nonnull String headerName)
ODataRequestResult
getHeaderValues
in interface ODataRequestResult
headerName
- The header name to look for.@Nonnull public Iterable<String> getHeaderNames()
ODataRequestResult
getHeaderNames
in interface ODataRequestResult
@Nonnull public io.vavr.control.Try<ODataRequestResultGeneric> tryGetNextPage()
ODataRequestResultPagination
tryGetNextPage
in interface ODataRequestResultPagination
null
if last page of result-set.public boolean hasPayload()
HttpEntity
.@Nonnull public ODataRequestGeneric getODataRequest()
ODataRequestResult
ODataRequestExecutable
instance that was used for running the OData request.getODataRequest
in interface ODataRequestResult
getODataRequest
in interface ODataRequestResultPagination
ODataRequestExecutable
instance.Copyright © 2021 SAP SE. All rights reserved.