Class SimpleEndpoint<RequestT,ResponseT>
java.lang.Object
co.elastic.clients.transport.endpoints.SimpleEndpoint<RequestT,ResponseT>
- All Implemented Interfaces:
Endpoint<RequestT,ResponseT,ErrorResponse>,JsonEndpoint<RequestT,ResponseT,ErrorResponse>
- Direct Known Subclasses:
BooleanEndpoint
public class SimpleEndpoint<RequestT,ResponseT> extends java.lang.Object implements JsonEndpoint<RequestT,ResponseT,ErrorResponse>
-
Constructor Summary
Constructors Constructor Description SimpleEndpoint(java.lang.String id, java.util.function.Function<RequestT,java.lang.String> method, java.util.function.Function<RequestT,java.lang.String> requestUrl, java.util.function.Function<RequestT,java.util.Map<java.lang.String,java.lang.String>> queryParameters, java.util.function.Function<RequestT,java.util.Map<java.lang.String,java.lang.String>> headers, boolean hasRequestBody, JsonpDeserializer<ResponseT> responseParser) -
Method Summary
Modifier and Type Method Description static <T> java.util.function.Function<T,java.util.Map<java.lang.String,java.lang.String>>emptyMap()Returns a function that always returns an empty String to String map.JsonpDeserializer<ErrorResponse>errorDeserializer(int statusCode)The entity parser for the error response body.booleanhasRequestBody()java.util.Map<java.lang.String,java.lang.String>headers(RequestT request)Get the HTTP headers for a request.java.lang.Stringid()The endpoint's identifier.booleanisError(int statusCode)Is this status code to be considered as an error?java.lang.Stringmethod(RequestT request)Get the endpoint's HTTP method for a request.static java.lang.RuntimeExceptionnoPathTemplateFound(java.lang.String what)static voidpathEncode(java.lang.String src, java.lang.StringBuilder dest)java.util.Map<java.lang.String,java.lang.String>queryParameters(RequestT request)Get the query parameters for a request.java.lang.StringrequestUrl(RequestT request)Get the URL path for a request.JsonpDeserializer<ResponseT>responseDeserializer()The entity parser for the response body.<NewResponseT>
SimpleEndpoint<RequestT,NewResponseT>withResponseDeserializer(JsonpDeserializer<NewResponseT> newResponseParser)Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
SimpleEndpoint
public SimpleEndpoint(java.lang.String id, java.util.function.Function<RequestT,java.lang.String> method, java.util.function.Function<RequestT,java.lang.String> requestUrl, java.util.function.Function<RequestT,java.util.Map<java.lang.String,java.lang.String>> queryParameters, java.util.function.Function<RequestT,java.util.Map<java.lang.String,java.lang.String>> headers, boolean hasRequestBody, JsonpDeserializer<ResponseT> responseParser)
-
-
Method Details
-
emptyMap
public static <T> java.util.function.Function<T,java.util.Map<java.lang.String,java.lang.String>> 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. -
id
public java.lang.String 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>
-
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>
-
hasRequestBody
public boolean hasRequestBody()- Specified by:
hasRequestBodyin interfaceEndpoint<RequestT,ResponseT,ErrorResponse>
-
responseDeserializer
Description copied from interface:JsonEndpointThe entity parser for the response body.- Specified by:
responseDeserializerin interfaceJsonEndpoint<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
public static java.lang.RuntimeException noPathTemplateFound(java.lang.String what) -
pathEncode
public static void pathEncode(java.lang.String src, java.lang.StringBuilder dest)
-