R
- result type, maybe directly T
or sth. like List<T>
T
- type of the query resultC
- type of the class implementing this classpublic abstract class MetaModelHeadDslImpl<R,T,C extends MetaModelHeadDsl<R,T,C>> extends Base implements MetaModelHeadDsl<R,T,C>
Modifier | Constructor and Description |
---|---|
protected |
MetaModelHeadDslImpl(com.fasterxml.jackson.databind.JavaType javaType,
String endpoint,
String identifierToSearchFor,
Function<MetaModelHeadDslBuilder<R,T,C>,C> builderFunction,
List<NameValuePair> additionalParameters) |
protected |
MetaModelHeadDslImpl(JsonEndpoint<R> endpoint,
String identifierToSearchFor,
Function<MetaModelHeadDslBuilder<R,T,C>,C> builderFunction,
List<NameValuePair> additionalParameters) |
protected |
MetaModelHeadDslImpl(MetaModelHeadDslBuilder<R,T,C> builder) |
protected |
MetaModelHeadDslImpl(String identifierToSearchFor,
JsonEndpoint<R> endpoint,
Function<MetaModelHeadDslBuilder<R,T,C>,C> builderFunction) |
Modifier and Type | Method and Description |
---|---|
protected List<NameValuePair> |
additionalQueryParameters() |
boolean |
canDeserialize(HttpResponse httpResponse)
Checks if the response can be handled by
SphereRequest.deserialize(HttpResponse) . |
protected MetaModelHeadDslBuilder<R,T,C> |
copyBuilder() |
R |
deserialize(HttpResponse httpResponse)
Takes an http response and maps it into a Java object of type T.
|
HttpRequestIntent |
httpRequestIntent()
Provides an http request intent, this does not include the execution of it.
|
protected com.fasterxml.jackson.databind.JavaType |
jacksonJavaType() |
protected C |
withAdditionalQueryParameters(List<NameValuePair> pairs) |
protected MetaModelHeadDslImpl(JsonEndpoint<R> endpoint, String identifierToSearchFor, Function<MetaModelHeadDslBuilder<R,T,C>,C> builderFunction, List<NameValuePair> additionalParameters)
protected MetaModelHeadDslImpl(String identifierToSearchFor, JsonEndpoint<R> endpoint, Function<MetaModelHeadDslBuilder<R,T,C>,C> builderFunction)
protected MetaModelHeadDslImpl(MetaModelHeadDslBuilder<R,T,C> builder)
@Nullable public R deserialize(HttpResponse httpResponse)
SphereRequest
SphereRequest.canDeserialize(HttpResponse)
if the response can be consumed.deserialize
in interface SphereRequest<R>
deserialize
in interface Head<R>
httpResponse
- the http response of the APIpublic HttpRequestIntent httpRequestIntent()
SphereRequest
httpRequestIntent
in interface SphereRequest<R>
protected com.fasterxml.jackson.databind.JavaType jacksonJavaType()
protected List<NameValuePair> additionalQueryParameters()
public boolean canDeserialize(HttpResponse httpResponse)
SphereRequest
SphereRequest.deserialize(HttpResponse)
.
Use case 1: A http response returns 404 and the this SphereRequest
can handle this error by returning an empty optional, an empty list or throwing a domain specific exception.canDeserialize
in interface SphereRequest<R>
httpResponse
- the http response which shall be transformedprotected MetaModelHeadDslBuilder<R,T,C> copyBuilder()
protected C withAdditionalQueryParameters(List<NameValuePair> pairs)