Class ExtensionErrorBuilder

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

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

     ExtensionError extensionError = ExtensionError.builder()
             .code("{code}")
             .message("{message}")
             .extensionId("{extensionId}")
             .build()
 
  • Constructor Details

    • ExtensionErrorBuilder

      public ExtensionErrorBuilder()
  • Method Details

    • code

      public ExtensionErrorBuilder code(String code)

      Error code caused by the Extension. For example, InvalidField.

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

      public ExtensionErrorBuilder message(String message)

      Plain text description of the error.

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

      public ExtensionErrorBuilder extensionId(String extensionId)

      Unique identifier of the Extension.

      Parameters:
      extensionId - value to be set
      Returns:
      Builder
    • extensionKey

      public ExtensionErrorBuilder extensionKey(@Nullable String extensionKey)

      User-defined unique identifier of the Extension.

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

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

      Error-specific additional fields.

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

      public ExtensionErrorBuilder addValue(String key, Object value)

      Error-specific additional fields.

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

      public String getCode()

      Error code caused by the Extension. For example, InvalidField.

      Returns:
      code
    • getMessage

      public String getMessage()

      Plain text description of the error.

      Returns:
      message
    • getExtensionId

      public String getExtensionId()

      Unique identifier of the Extension.

      Returns:
      extensionId
    • getExtensionKey

      @Nullable public String getExtensionKey()

      User-defined unique identifier of the Extension.

      Returns:
      extensionKey
    • getValues

      public Map<String,Object> getValues()

      Error-specific additional fields.

      Returns:
      pattern properties
    • build

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

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

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

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