@Beta public class ODataRequestResultGeneric extends Object implements ODataRequestResult, ODataRequestResultDeserializable, Iterable<ResultElement>
Constructor and Description |
---|
ODataRequestResultGeneric(ODataRequestGeneric oDataRequest,
org.apache.http.HttpResponse httpResponse) |
Modifier and Type | Method and Description |
---|---|
<T> T |
as(Class<T> objectType)
Converts ODataRequestResult into POJO
|
<T> List<T> |
asList(Class<T> objectType)
Converts ODataRequestResult into list of POJO
|
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) |
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()
Get the original OData HttpResponse instance, which holds the HttpEntity and header information.
|
long |
getInlineCount()
Get the count of elements in the 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() |
Iterator<ResultElement> |
iterator()
Create an iterator for the result elements
|
protected void |
requireHealthyResponse()
Check the HTTP response code of the OData request result.
|
void |
streamElements(Consumer<ResultElement> handler)
Run a consumer for fluent API type ResultElement to iterate over the OData response with a continuous data
stream.
|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public ODataRequestResultGeneric(@Nonnull ODataRequestGeneric oDataRequest, @Nonnull org.apache.http.HttpResponse httpResponse)
@Nonnull protected Map<String,Iterable<String>> getResponseHeaders()
public void streamElements(@Nonnull Consumer<ResultElement> handler)
streamElements
in interface ODataRequestResultDeserializable
handler
- The consumer for generic ResultElement.@Nonnull public Iterator<ResultElement> iterator()
iterator
in interface Iterable<ResultElement>
ODataErrorResponseException
- When the received OData service response contained a parsable error message.ODataDeserializationException
- When deserialization process failed for the OData response object.ODataDeserializationException
- When the received OData service response contained a non-parsable error message.@Nonnull public <T> T as(@Nonnull Class<T> objectType)
as
in interface ODataRequestResultDeserializable
T
- The generic type of POJOobjectType
- type of POJOODataErrorResponseException
- When the received OData service response contained a parsable error message.ODataDeserializationException
- When deserialization process failed for the OData response object.ODataDeserializationException
- When the received OData service response contained a non-parsable error message.@Nonnull public <T> List<T> asList(@Nonnull Class<T> objectType)
asList
in interface ODataRequestResultDeserializable
T
- Generic type of the POJOobjectType
- type of POJOODataErrorResponseException
- When the received OData service response contained a parsable error message.ODataDeserializationException
- When deserialization process failed for the OData response object.ODataDeserializationException
- When the received OData service response contained a non-parsable error message.public long getInlineCount()
ODataRequestResultDeserializable
getInlineCount
in interface ODataRequestResultDeserializable
@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
protected void requireHealthyResponse()
ODataServiceException
- When the response code infers an unhealthy state, i.e. when >= 400ODataErrorResponseException
- When the response contains an OData error message according to specification.@Nonnull public io.vavr.control.Option<String> getVersionIdentifierFromHeader()
Option.None
, if none was found.@Nonnull public ODataRequestGeneric getODataRequest()
ODataRequestResult
getODataRequest
in interface ODataRequestResult
@Nonnull public org.apache.http.HttpResponse getHttpResponse()
ODataRequestResult
getHttpResponse
in interface ODataRequestResult
Copyright © 2020 SAP SE. All rights reserved.