Class EndpointBase<RequestT,ResponseT>
java.lang.Object
co.elastic.clients.transport.endpoints.EndpointBase<RequestT,ResponseT>
- All Implemented Interfaces:
Endpoint<RequestT,ResponseT, ErrorResponse>
- Direct Known Subclasses:
BinaryEndpoint,BooleanEndpoint,SimpleEndpoint
public class EndpointBase<RequestT,ResponseT>
extends Object
implements Endpoint<RequestT,ResponseT,ErrorResponse>
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionEndpointBase(String id, Function<RequestT, String> method, Function<RequestT, String> requestUrl, Function<RequestT, Map<String, String>> pathParameters, Function<RequestT, Map<String, String>> queryParameters, Function<RequestT, Map<String, String>> headers, Function<RequestT, Object> body) -
Method Summary
Modifier and TypeMethodDescriptionGet the body for a request.emptyMap()Returns a function that always returns an empty String to String map.errorDeserializer(int statusCode) The entity parser for the error response body.Get the HTTP headers for a request.id()The endpoint's identifier.booleanisError(int statusCode) Is this status code to be considered as an error?Get the endpoint's HTTP method for a request.static RuntimeExceptionnoPathTemplateFound(String what) static voidpathEncode(String src, StringBuilder dest) pathParameters(RequestT request) Get the path parameters for a request.queryParameters(RequestT request) Get the query parameters for a request.requestUrl(RequestT request) Get the URL path for a request.static <T,U> Function<T, U> Returns a function that always returns its parameter.<NewResponseT>
SimpleEndpoint<RequestT,NewResponseT> withResponseDeserializer(JsonpDeserializer<NewResponseT> newResponseParser)
-
Field Details
-
id
-
method
-
requestUrl
-
pathParameters
-
queryParameters
-
headers
-
body
-
-
Constructor Details
-
EndpointBase
-
-
Method Details
-
emptyMap
Returns a function that always returns an empty String to String map. Useful to avoid creating lots of duplicate lambdas in endpoints that don't have headers or parameters. -
returnSelf
Returns a function that always returns its parameter. It's similar toFunction.identity()with the difference that the input and output generic parameters are different, making it suitable for use in a wider range of use cases. -
id
Description copied from interface:EndpointThe endpoint's identifier.- Specified by:
idin interfaceEndpoint<RequestT,ResponseT, ErrorResponse>
-
method
Description copied from interface:EndpointGet the endpoint's HTTP method for a request.- Specified by:
methodin interfaceEndpoint<RequestT,ResponseT, ErrorResponse>
-
requestUrl
Description copied from interface:EndpointGet the URL path for a request.- Specified by:
requestUrlin interfaceEndpoint<RequestT,ResponseT, ErrorResponse>
-
pathParameters
Description copied from interface:EndpointGet the path parameters for a request.- Specified by:
pathParametersin interfaceEndpoint<RequestT,ResponseT, ErrorResponse>
-
queryParameters
Description copied from interface:EndpointGet the query parameters for a request.- Specified by:
queryParametersin interfaceEndpoint<RequestT,ResponseT, ErrorResponse>
-
headers
Description copied from interface:EndpointGet the HTTP headers for a request.- Specified by:
headersin interfaceEndpoint<RequestT,ResponseT, ErrorResponse>
-
body
Description copied from interface:EndpointGet the body for a request. The caller must handle several cases depending on the interface implemented by the result:nullmeans the request has no body.NdJsonpSerializablemust be serialized as nd-json.BinaryDatamust be serialized as is.- All other objects must be serialized as JSON using a
JsonpMapper- Specified by:
bodyin interfaceEndpoint<RequestT,ResponseT, ErrorResponse>
-
isError
public boolean isError(int statusCode) Description copied from interface:EndpointIs this status code to be considered as an error?- Specified by:
isErrorin interfaceEndpoint<RequestT,ResponseT, ErrorResponse>
-
errorDeserializer
Description copied from interface:EndpointThe entity parser for the error response body. Can benullto indicate that there's no error body.- Specified by:
errorDeserializerin interfaceEndpoint<RequestT,ResponseT, ErrorResponse>
-
withResponseDeserializer
public <NewResponseT> SimpleEndpoint<RequestT,NewResponseT> withResponseDeserializer(JsonpDeserializer<NewResponseT> newResponseParser) -
noPathTemplateFound
-
pathEncode
-