Package com.commercetools.graphql.api
Class GraphQLRequestBuilder<T>
java.lang.Object
com.commercetools.graphql.api.GraphQLRequestBuilder<T>
- All Implemented Interfaces:
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
ConstructorDescriptionGraphQLRequestBuilder
(String query, String operationName, GraphQLVariablesMap variables, Function<GraphQLData, T> dataMapper) -
Method Summary
Modifier and TypeMethodDescriptionbuild()
builds GraphQLRequest with checking for non-null required valuesbuilds GraphQLRequest without checking for non-null required values<TData> GraphQLRequestBuilder<TData>
dataMapper
(Function<GraphQLData, TData> dataMapper) value of operationName}getQuery()
value of query}value 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
(GraphQLVariablesMap variables) set the value to the variablesset the value to the variables using the builder functionset the value to the variables using the builder function
-
Constructor Details
-
GraphQLRequestBuilder
public GraphQLRequestBuilder(String query, @Nullable String operationName, @Nullable GraphQLVariablesMap variables, @Nullable Function<GraphQLData, T> dataMapper) -
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<GraphQLVariablesMapBuilder, 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<GraphQLVariablesMapBuilder, GraphQLVariablesMap> builder) set the value to the variables using the builder function- Parameters:
builder
- function to build the variables value- Returns:
- Builder
-
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 -
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
-