Class GraphQLErrorBuilder

java.lang.Object
com.commercetools.api.models.graph_ql.GraphQLErrorBuilder
All Implemented Interfaces:
Builder<GraphQLError>

public class GraphQLErrorBuilder extends Object implements Builder<GraphQLError>
GraphQLErrorBuilder
Example to create an instance using the builder pattern

     GraphQLError graphQLError = GraphQLError.builder()
             .message("{message}")
             .plusLocations(locationsBuilder -> locationsBuilder)
             .extensions(extensionsBuilder -> extensionsBuilder)
             .build()
 
  • Constructor Details

    • GraphQLErrorBuilder

      public GraphQLErrorBuilder()
  • Method Details

    • message

      public GraphQLErrorBuilder message(String message)

      Detailed description of the error explaining the root cause of the problem and suggesting how to correct the error.

      Parameters:
      message - value to be set
      Returns:
      Builder
    • locations

      public GraphQLErrorBuilder locations(GraphQLErrorLocation... locations)

      Location within your query where the error occurred.

      Parameters:
      locations - value to be set
      Returns:
      Builder
    • locations

      public GraphQLErrorBuilder locations(List<GraphQLErrorLocation> locations)

      Location within your query where the error occurred.

      Parameters:
      locations - value to be set
      Returns:
      Builder
    • plusLocations

      public GraphQLErrorBuilder plusLocations(GraphQLErrorLocation... locations)

      Location within your query where the error occurred.

      Parameters:
      locations - value to be set
      Returns:
      Builder
    • plusLocations

      Location within your query where the error occurred.

      Parameters:
      builder - function to build the locations value
      Returns:
      Builder
    • withLocations

      Location within your query where the error occurred.

      Parameters:
      builder - function to build the locations value
      Returns:
      Builder
    • addLocations

      Location within your query where the error occurred.

      Parameters:
      builder - function to build the locations value
      Returns:
      Builder
    • setLocations

      Location within your query where the error occurred.

      Parameters:
      builder - function to build the locations value
      Returns:
      Builder
    • path

      public GraphQLErrorBuilder path(@Nullable Object... path)

      Query fields listed in order from the root of the query response up to the field in which the error occurred. path is displayed in the response only if an error is associated with a particular field in the query result.

      Parameters:
      path - value to be set
      Returns:
      Builder
    • path

      Query fields listed in order from the root of the query response up to the field in which the error occurred. path is displayed in the response only if an error is associated with a particular field in the query result.

      Parameters:
      path - value to be set
      Returns:
      Builder
    • plusPath

      public GraphQLErrorBuilder plusPath(@Nullable Object... path)

      Query fields listed in order from the root of the query response up to the field in which the error occurred. path is displayed in the response only if an error is associated with a particular field in the query result.

      Parameters:
      path - value to be set
      Returns:
      Builder
    • extensions

      public GraphQLErrorBuilder extensions(GraphQLErrorObject extensions)

      Dictionary with additional information where applicable.

      Parameters:
      extensions - value to be set
      Returns:
      Builder
    • extensions

      Dictionary with additional information where applicable.

      Parameters:
      builder - function to build the extensions value
      Returns:
      Builder
    • getMessage

      public String getMessage()

      Detailed description of the error explaining the root cause of the problem and suggesting how to correct the error.

      Returns:
      message
    • getLocations

      public List<GraphQLErrorLocation> getLocations()

      Location within your query where the error occurred.

      Returns:
      locations
    • getPath

      @Nullable public List<Object> getPath()

      Query fields listed in order from the root of the query response up to the field in which the error occurred. path is displayed in the response only if an error is associated with a particular field in the query result.

      Returns:
      path
    • getExtensions

      public GraphQLErrorObject getExtensions()

      Dictionary with additional information where applicable.

      Returns:
      extensions
    • build

      public GraphQLError build()
      builds GraphQLError with checking for non-null required values
      Specified by:
      build in interface Builder<GraphQLError>
      Returns:
      GraphQLError
    • buildUnchecked

      public GraphQLError buildUnchecked()
      builds GraphQLError without checking for non-null required values
      Returns:
      GraphQLError
    • of

      public static GraphQLErrorBuilder of()
      factory method for an instance of GraphQLErrorBuilder
      Returns:
      builder
    • of

      public static GraphQLErrorBuilder of(GraphQLError template)
      create builder for GraphQLError instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder