Class DuplicateFieldErrorBuilder

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

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

     DuplicateFieldError duplicateFieldError = DuplicateFieldError.builder()
             .message("{message}")
             .field("{field}")
             .build()
 
  • Constructor Details

    • DuplicateFieldErrorBuilder

      public DuplicateFieldErrorBuilder()
  • Method Details

    • message

      public DuplicateFieldErrorBuilder message(String message)

      "A duplicate value $duplicateValue exists for field $field."

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

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

      Error-specific additional fields.

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

      public DuplicateFieldErrorBuilder addValue(String key, Object value)

      Error-specific additional fields.

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

      public DuplicateFieldErrorBuilder field(String field)

      Name of the conflicting field.

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

      public DuplicateFieldErrorBuilder duplicateValue(Object duplicateValue)

      Conflicting duplicate value.

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

      public String getMessage()

      "A duplicate value $duplicateValue exists 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 conflicting field.

      Returns:
      field
    • getDuplicateValue

      public Object getDuplicateValue()

      Conflicting duplicate value.

      Returns:
      duplicateValue
    • build

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

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

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

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