public class QueryExecutorImpl extends Object implements QueryExecutor
QueryExecutorImpl(String) for more information.GRAPHQL_MARKER, GRAPHQL_MUTATION_MARKER, GRAPHQL_QUERY_MARKER, GRAPHQL_SUBSCRIPTION_MARKER| Constructor and Description |
|---|
QueryExecutorImpl(String graphqlEndpoint)
This constructor expects the URI of the GraphQL server.
|
QueryExecutorImpl(String graphqlEndpoint,
SSLContext sslContext,
HostnameVerifier hostnameVerifier)
This constructor expects the URI of the GraphQL server.
|
| Modifier and Type | Method and Description |
|---|---|
<T> T |
execute(String query,
Class<T> valueType)
Execution of the given simple GraphQL query, and return its response mapped in the relevant POJO.
|
<T> T |
execute(String requestType,
ObjectResponse objectResponse,
List<InputParameter> parameters,
Class<T> valueType)
Execution of the given simple GraphQL query, and return its response mapped in the relevant POJO.
|
public QueryExecutorImpl(String graphqlEndpoint)
graphqlEndpoint - the http URI for the GraphQL endpointpublic QueryExecutorImpl(String graphqlEndpoint, SSLContext sslContext, HostnameVerifier hostnameVerifier)
graphqlEndpoint - the https URI for the GraphQL endpointsslContext - hostnameVerifier - public <T> T execute(String requestType, ObjectResponse objectResponse, List<InputParameter> parameters, Class<T> valueType) throws GraphQLExecutionException
ObjectResponse for your application in your
constructor, or in whatever initialization code you have. Using this allows to be sure at startup that the syntax
for all your GraphQL request is valid.execute in interface QueryExecutorrequestType - One of "query", "mutation" or "subscription"objectResponse - Defines what response is expected from the server. The ObjectResponse.getFieldAlias() method
returns the field of the query, that is: the query name.parameters - the input parameters for this query. If the query has no parameters, it may be null or an empty list.GraphQLExecutionException - When an error occurs during the request execution, typically a network error, an error from the
GraphQL server or if the server response can't be parsedpublic <T> T execute(String query, Class<T> valueType) throws IOException, GraphQLExecutionException
execute in interface QueryExecutorT - The GraphQL type to map the response intoquery - A string which contains the query, in the GraphQL language. For instance: "{ hero { name } }"valueType - The GraphQL type to map the response intoIOExceptionGraphQLExecutionExceptionCopyright © 2019. All rights reserved.