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

     GraphQLRequest graphQLRequest = GraphQLRequest.builder()
             .query("{query}")
             .build()
 
  • Constructor Details

  • Method Details

    • query

      public GraphQLRequestBuilder<T> query(String query)
      set the value to the query
      Parameters:
      query - value to be set
      Returns:
      Builder
    • operationName

      public GraphQLRequestBuilder<T> operationName(@Nullable String 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

      public <TData> GraphQLRequestBuilder<TData> dataMapper(Function<GraphQLData,TData> dataMapper)
    • getQuery

      public String getQuery()
      value of query}
      Returns:
      query
    • getOperationName

      @Nullable public String getOperationName()
      value of operationName}
      Returns:
      operationName
    • getVariables

      @Nullable public com.commercetools.api.models.graph_ql.GraphQLVariablesMap getVariables()
      value of variables}
      Returns:
      variables
    • getDataMapper

      @Nullable public Function<GraphQLData,T> getDataMapper()
    • build

      public GraphQLRequest<T> build()
      builds GraphQLRequest with checking for non-null required values
      Specified by:
      build in interface io.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

      public static <T> GraphQLRequestBuilder<T> of()
      factory method for an instance of GraphQLRequestBuilder
      Returns:
      builder
    • of

      public static <T> GraphQLRequestBuilder<T> of(GraphQLRequest<T> template)
      create builder for GraphQLRequest instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder