public interface QueryExecutor
| Modifier and Type | Field and Description |
|---|---|
static org.apache.logging.log4j.Marker |
GRAPHQL_MARKER |
static org.apache.logging.log4j.Marker |
GRAPHQL_MUTATION_MARKER |
static org.apache.logging.log4j.Marker |
GRAPHQL_QUERY_MARKER |
static org.apache.logging.log4j.Marker |
GRAPHQL_SUBSCRIPTION_MARKER |
| Modifier and Type | Method and Description |
|---|---|
<T> T |
execute(String graphqlQuery,
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.
|
static final org.apache.logging.log4j.Marker GRAPHQL_MARKER
static final org.apache.logging.log4j.Marker GRAPHQL_QUERY_MARKER
static final org.apache.logging.log4j.Marker GRAPHQL_MUTATION_MARKER
static final org.apache.logging.log4j.Marker GRAPHQL_SUBSCRIPTION_MARKER
<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.T - requestType - 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 parsedIOException<T> T execute(String graphqlQuery, Class<T> valueType) throws GraphQLExecutionException, IOException
T - The GraphQL type to map the response intographqlQuery - A string which contains the query, in the GraphQL language. For instance: "{ hero { name } }"queryName - The name of the query. In this sample: "hero"valueType - The GraphQL type to map the response intoGraphQLExecutionExceptionIOExceptionCopyright © 2019. All rights reserved.