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.boolean
hasRequestBody()
java.util.Map<java.lang.String,java.lang.String>
headers(RequestT request)
Build the headers for a requestboolean
isError(int statusCode)
java.lang.String
method(RequestT request)
The endpoint's http methodstatic java.lang.RuntimeException
noPathTemplateFound(java.lang.String what)
static void
pathEncode(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.String
requestUrl(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:Endpoint
The endpoint's http method- Specified by:
method
in interfaceEndpoint<RequestT,ResponseT,ElasticsearchError>
-
requestUrl
Description copied from interface:Endpoint
Build the URL path for a request- Specified by:
requestUrl
in interfaceEndpoint<RequestT,ResponseT,ElasticsearchError>
-
queryParameters
Description copied from interface:Endpoint
Build the query parameters for a request- Specified by:
queryParameters
in interfaceEndpoint<RequestT,ResponseT,ElasticsearchError>
-
headers
Description copied from interface:Endpoint
Build the headers for a request- Specified by:
headers
in interfaceEndpoint<RequestT,ResponseT,ElasticsearchError>
-
hasRequestBody
public boolean hasRequestBody()- Specified by:
hasRequestBody
in interfaceEndpoint<RequestT,ResponseT,ElasticsearchError>
-
responseParser
Description copied from interface:Endpoint
The entity parser for the response body. Can benull
to indicate that there's no response body.- Specified by:
responseParser
in interfaceEndpoint<RequestT,ResponseT,ElasticsearchError>
-
isError
public boolean isError(int statusCode)- Specified by:
isError
in interfaceEndpoint<RequestT,ResponseT,ElasticsearchError>
-
errorParser
Description copied from interface:Endpoint
The entity parser for the error response body. Can benull
to indicate that there's no error body.- Specified by:
errorParser
in 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)
-