Class VariantBuilder

java.lang.Object
com.commercetools.history.models.common.VariantBuilder
All Implemented Interfaces:
Builder<Variant>

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

     Variant variant = Variant.builder()
             .id(1)
             .sku("{sku}")
             .key("{key}")
             .build()
 
  • Constructor Details

    • VariantBuilder

      public VariantBuilder()
  • Method Details

    • id

      public VariantBuilder id(Integer id)
      set the value to the id
      Parameters:
      id - value to be set
      Returns:
      Builder
    • sku

      public VariantBuilder sku(String sku)
      set the value to the sku
      Parameters:
      sku - value to be set
      Returns:
      Builder
    • key

      public VariantBuilder key(String key)
      set the value to the key
      Parameters:
      key - value to be set
      Returns:
      Builder
    • getId

      public Integer getId()
      value of id}
      Returns:
      id
    • getSku

      public String getSku()
      value of sku}
      Returns:
      sku
    • getKey

      public String getKey()
      value of key}
      Returns:
      key
    • build

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

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

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

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