Class AttributeValueBuilder

java.lang.Object
com.commercetools.history.models.change_value.AttributeValueBuilder
All Implemented Interfaces:
Builder<AttributeValue>

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

     AttributeValue attributeValue = AttributeValue.builder()
             .name("{name}")
             .build()
 
  • Constructor Details

    • AttributeValueBuilder

      public AttributeValueBuilder()
  • Method Details

    • name

      public AttributeValueBuilder name(String name)

      Name of the Attribute set.

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

      public AttributeValueBuilder value(Object value)

      Value set for the Attribute determined by the AttributeType:

      • For Enum Type and Localized Enum Type, value is the key of the Plain Enum Value or Localized Enum Value objects, or the complete objects.
      • For Localizable Text Type, value is the LocalizedString object.
      • For Money Type Attributes, value is the Money object.
      • For Set Type Attributes, value is the entire set object.
      • For Nested Type Attributes, value is the list of values of all Attributes of the nested Product.
      • For Reference Type Attributes, value is the Reference object.
      Parameters:
      value - value to be set
      Returns:
      Builder
    • getName

      public String getName()

      Name of the Attribute set.

      Returns:
      name
    • getValue

      public Object getValue()

      Value set for the Attribute determined by the AttributeType:

      • For Enum Type and Localized Enum Type, value is the key of the Plain Enum Value or Localized Enum Value objects, or the complete objects.
      • For Localizable Text Type, value is the LocalizedString object.
      • For Money Type Attributes, value is the Money object.
      • For Set Type Attributes, value is the entire set object.
      • For Nested Type Attributes, value is the list of values of all Attributes of the nested Product.
      • For Reference Type Attributes, value is the Reference object.
      Returns:
      value
    • build

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

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

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

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