Class LineItemBuilder

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

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

     LineItem lineItem = LineItem.builder()
             .addedAt("{addedAt}")
             .custom(customBuilder -> customBuilder)
             .id("{id}")
             .name(nameBuilder -> nameBuilder)
             .productId("{productId}")
             .productSlug(productSlugBuilder -> productSlugBuilder)
             .productType(productTypeBuilder -> productTypeBuilder)
             .quantity(1)
             .variant(variantBuilder -> variantBuilder)
             .variantId(1)
             .build()
 
  • Constructor Details

    • LineItemBuilder

      public LineItemBuilder()
  • Method Details

    • addedAt

      public LineItemBuilder addedAt(String addedAt)
      set the value to the addedAt
      Parameters:
      addedAt - value to be set
      Returns:
      Builder
    • custom

      set the value to the custom using the builder function
      Parameters:
      builder - function to build the custom value
      Returns:
      Builder
    • withCustom

      set the value to the custom using the builder function
      Parameters:
      builder - function to build the custom value
      Returns:
      Builder
    • custom

      public LineItemBuilder custom(CustomFields custom)
      set the value to the custom
      Parameters:
      custom - value to be set
      Returns:
      Builder
    • id

      public LineItemBuilder id(String id)
      set the value to the id
      Parameters:
      id - value to be set
      Returns:
      Builder
    • name

      set the value to the name using the builder function
      Parameters:
      builder - function to build the name value
      Returns:
      Builder
    • withName

      set the value to the name using the builder function
      Parameters:
      builder - function to build the name value
      Returns:
      Builder
    • name

      public LineItemBuilder name(LocalizedString name)
      set the value to the name
      Parameters:
      name - value to be set
      Returns:
      Builder
    • productId

      public LineItemBuilder productId(String productId)
      set the value to the productId
      Parameters:
      productId - value to be set
      Returns:
      Builder
    • productSlug

      set the value to the productSlug using the builder function
      Parameters:
      builder - function to build the productSlug value
      Returns:
      Builder
    • withProductSlug

      set the value to the productSlug using the builder function
      Parameters:
      builder - function to build the productSlug value
      Returns:
      Builder
    • productSlug

      public LineItemBuilder productSlug(LocalizedString productSlug)
      set the value to the productSlug
      Parameters:
      productSlug - value to be set
      Returns:
      Builder
    • productType

      set the value to the productType using the builder function
      Parameters:
      builder - function to build the productType value
      Returns:
      Builder
    • withProductType

      public LineItemBuilder withProductType(Function<ReferenceBuilder,Reference> builder)
      set the value to the productType using the builder function
      Parameters:
      builder - function to build the productType value
      Returns:
      Builder
    • productType

      public LineItemBuilder productType(Reference productType)
      set the value to the productType
      Parameters:
      productType - value to be set
      Returns:
      Builder
    • quantity

      public LineItemBuilder quantity(Integer quantity)
      set the value to the quantity
      Parameters:
      quantity - value to be set
      Returns:
      Builder
    • variant

      set the value to the variant using the builder function
      Parameters:
      builder - function to build the variant value
      Returns:
      Builder
    • withVariant

      public LineItemBuilder withVariant(Function<VariantBuilder,Variant> builder)
      set the value to the variant using the builder function
      Parameters:
      builder - function to build the variant value
      Returns:
      Builder
    • variant

      public LineItemBuilder variant(Variant variant)
      set the value to the variant
      Parameters:
      variant - value to be set
      Returns:
      Builder
    • variantId

      public LineItemBuilder variantId(Integer variantId)
      set the value to the variantId
      Parameters:
      variantId - value to be set
      Returns:
      Builder
    • getAddedAt

      public String getAddedAt()
      value of addedAt}
      Returns:
      addedAt
    • getCustom

      public CustomFields getCustom()
      value of custom}
      Returns:
      custom
    • getId

      public String getId()
      value of id}
      Returns:
      id
    • getName

      public LocalizedString getName()
      value of name}
      Returns:
      name
    • getProductId

      public String getProductId()
      value of productId}
      Returns:
      productId
    • getProductSlug

      public LocalizedString getProductSlug()
      value of productSlug}
      Returns:
      productSlug
    • getProductType

      public Reference getProductType()
      value of productType}
      Returns:
      productType
    • getQuantity

      public Integer getQuantity()
      value of quantity}
      Returns:
      quantity
    • getVariant

      public Variant getVariant()
      value of variant}
      Returns:
      variant
    • getVariantId

      public Integer getVariantId()
      value of variantId}
      Returns:
      variantId
    • build

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

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

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

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