Class InvalidFieldErrorBuilder

java.lang.Object
com.commercetools.api.models.error.InvalidFieldErrorBuilder
All Implemented Interfaces:
Builder<InvalidFieldError>

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

     InvalidFieldError invalidFieldError = InvalidFieldError.builder()
             .message("{message}")
             .field("{field}")
             .build()
 
  • Constructor Details

    • InvalidFieldErrorBuilder

      public InvalidFieldErrorBuilder()
  • Method Details

    • message

      public InvalidFieldErrorBuilder message(String message)

      "The value $invalidValue is not valid for field $field."

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

      public InvalidFieldErrorBuilder values(Map<String,Object> values)

      Error-specific additional fields.

      Parameters:
      values - properties to be set
      Returns:
      Builder
    • addValue

      public InvalidFieldErrorBuilder addValue(String key, Object value)

      Error-specific additional fields.

      Parameters:
      key - property name
      value - property value
      Returns:
      Builder
    • field

      public InvalidFieldErrorBuilder field(String field)

      Name of the field with the invalid value.

      Parameters:
      field - value to be set
      Returns:
      Builder
    • invalidValue

      public InvalidFieldErrorBuilder invalidValue(Object invalidValue)

      Value invalid for the field.

      Parameters:
      invalidValue - value to be set
      Returns:
      Builder
    • allowedValues

      public InvalidFieldErrorBuilder allowedValues(@Nullable Object... allowedValues)

      Fixed set of allowed values for the field, if any.

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

      public InvalidFieldErrorBuilder allowedValues(@Nullable List<Object> allowedValues)

      Fixed set of allowed values for the field, if any.

      Parameters:
      allowedValues - value to be set
      Returns:
      Builder
    • plusAllowedValues

      public InvalidFieldErrorBuilder plusAllowedValues(@Nullable Object... allowedValues)

      Fixed set of allowed values for the field, if any.

      Parameters:
      allowedValues - value to be set
      Returns:
      Builder
    • getMessage

      public String getMessage()

      "The value $invalidValue is not valid for field $field."

      Returns:
      message
    • getValues

      public Map<String,Object> getValues()

      Error-specific additional fields.

      Returns:
      pattern properties
    • getField

      public String getField()

      Name of the field with the invalid value.

      Returns:
      field
    • getInvalidValue

      public Object getInvalidValue()

      Value invalid for the field.

      Returns:
      invalidValue
    • getAllowedValues

      @Nullable public List<Object> getAllowedValues()

      Fixed set of allowed values for the field, if any.

      Returns:
      allowedValues
    • build

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

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

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

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