Class ErrorResponseBuilder

java.lang.Object
com.commercetools.importapi.models.errors.ErrorResponseBuilder
All Implemented Interfaces:
Builder<ErrorResponse>

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

     ErrorResponse errorResponse = ErrorResponse.builder()
             .statusCode(1)
             .message("{message}")
             .build()
 
  • Constructor Details

    • ErrorResponseBuilder

      public ErrorResponseBuilder()
  • Method Details

    • statusCode

      public ErrorResponseBuilder statusCode(Integer statusCode)

      The HTTP status code of the response.

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

      public ErrorResponseBuilder message(String message)

      Describes the error.

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

      public ErrorResponseBuilder error(@Nullable String error)

      This property is only used for OAuth2 errors. Contains the error code.

      Parameters:
      error - value to be set
      Returns:
      Builder
    • error_description

      public ErrorResponseBuilder error_description(@Nullable String error_description)

      This property is only used for OAuth2 errors. Additional information to assist the client developer in understanding the error.

      Parameters:
      error_description - value to be set
      Returns:
      Builder
    • errors

      public ErrorResponseBuilder errors(@Nullable ErrorObject... errors)

      The errors that caused this error response.

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

      The errors that caused this error response.

      Parameters:
      errors - value to be set
      Returns:
      Builder
    • plusErrors

      public ErrorResponseBuilder plusErrors(@Nullable ErrorObject... errors)

      The errors that caused this error response.

      Parameters:
      errors - value to be set
      Returns:
      Builder
    • plusErrors

      public ErrorResponseBuilder plusErrors(Function<ErrorObjectBuilder,Builder<? extends ErrorObject>> builder)

      The errors that caused this error response.

      Parameters:
      builder - function to build the errors value
      Returns:
      Builder
    • withErrors

      public ErrorResponseBuilder withErrors(Function<ErrorObjectBuilder,Builder<? extends ErrorObject>> builder)

      The errors that caused this error response.

      Parameters:
      builder - function to build the errors value
      Returns:
      Builder
    • getStatusCode

      public Integer getStatusCode()

      The HTTP status code of the response.

      Returns:
      statusCode
    • getMessage

      public String getMessage()

      Describes the error.

      Returns:
      message
    • getError

      @Nullable public String getError()

      This property is only used for OAuth2 errors. Contains the error code.

      Returns:
      error
    • getError_description

      @Nullable public String getError_description()

      This property is only used for OAuth2 errors. Additional information to assist the client developer in understanding the error.

      Returns:
      error_description
    • getErrors

      @Nullable public List<ErrorObject> getErrors()

      The errors that caused this error response.

      Returns:
      errors
    • build

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

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

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

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