Package com.commercetools.graphql.api
Class GraphQLRequestBuilder<T>
java.lang.Object
com.commercetools.graphql.api.GraphQLRequestBuilder<T>
- All Implemented Interfaces:
io.vrap.rmf.base.client.Builder<GraphQLRequest<T>>
public class GraphQLRequestBuilder<T>
extends Object
implements io.vrap.rmf.base.client.Builder<GraphQLRequest<T>>
GraphQLRequestBuilder
Example to create an instance using the builder pattern
Example to create an instance using the builder pattern
GraphQLRequest graphQLRequest = GraphQLRequest.builder()
.query("{query}")
.build()
-
Constructor Summary
ConstructorsConstructorDescriptionGraphQLRequestBuilder(String query, String operationName, com.commercetools.api.models.graph_ql.GraphQLVariablesMap variables, Function<GraphQLData, T> dataMapper) -
Method Summary
Modifier and TypeMethodDescriptionbuild()builds GraphQLRequest with checking for non-null required valuescom.commercetools.api.models.graph_ql.GraphQLRequestbuilds GraphQLRequest without checking for non-null required values<TData> GraphQLRequestBuilder<TData>dataMapper(Function<GraphQLData, TData> dataMapper) value of operationName}getQuery()value of query}com.commercetools.api.models.graph_ql.GraphQLVariablesMapvalue of variables}static <T> GraphQLRequestBuilder<T>of()factory method for an instance of GraphQLRequestBuilderstatic <T> GraphQLRequestBuilder<T>of(GraphQLRequest<T> template) create builder for GraphQLRequest instanceoperationName(String operationName) set the value to the operationNameset the value to the queryvariables(com.commercetools.api.models.graph_ql.GraphQLVariablesMap variables) set the value to the variablesvariables(Function<com.commercetools.api.models.graph_ql.GraphQLVariablesMapBuilder, com.commercetools.api.models.graph_ql.GraphQLVariablesMapBuilder> builder) set the value to the variables using the builder functionwithVariables(Function<com.commercetools.api.models.graph_ql.GraphQLVariablesMapBuilder, com.commercetools.api.models.graph_ql.GraphQLVariablesMap> builder) set the value to the variables using the builder function
-
Constructor Details
-
GraphQLRequestBuilder
-
GraphQLRequestBuilder
public GraphQLRequestBuilder()
-
-
Method Details
-
query
set the value to the query- Parameters:
query- value to be set- Returns:
- Builder
-
operationName
set the value to the operationName- Parameters:
operationName- value to be set- Returns:
- Builder
-
variables
public GraphQLRequestBuilder<T> variables(Function<com.commercetools.api.models.graph_ql.GraphQLVariablesMapBuilder, com.commercetools.api.models.graph_ql.GraphQLVariablesMapBuilder> builder) set the value to the variables using the builder function- Parameters:
builder- function to build the variables value- Returns:
- Builder
-
withVariables
public GraphQLRequestBuilder<T> withVariables(Function<com.commercetools.api.models.graph_ql.GraphQLVariablesMapBuilder, com.commercetools.api.models.graph_ql.GraphQLVariablesMap> builder) set the value to the variables using the builder function- Parameters:
builder- function to build the variables value- Returns:
- Builder
-
variables
public GraphQLRequestBuilder<T> variables(@Nullable com.commercetools.api.models.graph_ql.GraphQLVariablesMap variables) set the value to the variables- Parameters:
variables- value to be set- Returns:
- Builder
-
dataMapper
-
getQuery
value of query}- Returns:
- query
-
getOperationName
value of operationName}- Returns:
- operationName
-
getVariables
value of variables}- Returns:
- variables
-
getDataMapper
-
build
builds GraphQLRequest with checking for non-null required values- Specified by:
buildin interfaceio.vrap.rmf.base.client.Builder<T>- Returns:
- GraphQLRequest
-
buildUnchecked
public com.commercetools.api.models.graph_ql.GraphQLRequest buildUnchecked()builds GraphQLRequest without checking for non-null required values- Returns:
- GraphQLRequest
-
of
factory method for an instance of GraphQLRequestBuilder- Returns:
- builder
-
of
create builder for GraphQLRequest instance- Parameters:
template- instance with prefilled values for the builder- Returns:
- builder
-