Package co.elastic.clients.base
Class SimpleEndpoint<RequestT,ResponseT>
java.lang.Object
co.elastic.clients.base.SimpleEndpoint<RequestT,ResponseT>
- All Implemented Interfaces:
Endpoint<RequestT,ResponseT,ElasticsearchError>
- Direct Known Subclasses:
BooleanEndpoint
public class SimpleEndpoint<RequestT,ResponseT> extends java.lang.Object implements Endpoint<RequestT,ResponseT,ElasticsearchError>
-
Constructor Summary
Constructors Constructor Description SimpleEndpoint(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<ElasticsearchError>errorParser(int statusCode)The entity parser for the error response body.booleanhasRequestBody()java.util.Map<java.lang.String,java.lang.String>headers(RequestT request)Build the headers for a requestbooleanisError(int statusCode)java.lang.Stringmethod(RequestT request)The endpoint's http methodstatic 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)Build the query parameters for a requestjava.lang.StringrequestUrl(RequestT request)Build the URL path for a requestJsonpDeserializer<ResponseT>responseParser()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.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. -
method
Description copied from interface:EndpointThe endpoint's http method- Specified by:
methodin interfaceEndpoint<RequestT,ResponseT,ElasticsearchError>
-
requestUrl
Description copied from interface:EndpointBuild the URL path for a request- Specified by:
requestUrlin interfaceEndpoint<RequestT,ResponseT,ElasticsearchError>
-
queryParameters
Description copied from interface:EndpointBuild the query parameters for a request- Specified by:
queryParametersin interfaceEndpoint<RequestT,ResponseT,ElasticsearchError>
-
headers
Description copied from interface:EndpointBuild the headers for a request- Specified by:
headersin interfaceEndpoint<RequestT,ResponseT,ElasticsearchError>
-
hasRequestBody
public boolean hasRequestBody()- Specified by:
hasRequestBodyin interfaceEndpoint<RequestT,ResponseT,ElasticsearchError>
-
responseParser
Description copied from interface:EndpointThe entity parser for the response body. Can benullto indicate that there's no response body.- Specified by:
responseParserin interfaceEndpoint<RequestT,ResponseT,ElasticsearchError>
-
isError
public boolean isError(int statusCode)- Specified by:
isErrorin interfaceEndpoint<RequestT,ResponseT,ElasticsearchError>
-
errorParser
Description copied from interface:EndpointThe entity parser for the error response body. Can benullto indicate that there's no error body.- Specified by:
errorParserin interfaceEndpoint<RequestT,ResponseT,ElasticsearchError>
-
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)
-