Class CustomLineItemBuilder

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

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

     CustomLineItem customLineItem = CustomLineItem.builder()
             .id("{id}")
             .name(nameBuilder -> nameBuilder)
             .money(moneyBuilder -> moneyBuilder)
             .taxedPrice(taxedPriceBuilder -> taxedPriceBuilder)
             .totalPrice(totalPriceBuilder -> totalPriceBuilder)
             .slug("{slug}")
             .quantity(1)
             .build()
 
  • Constructor Details

    • CustomLineItemBuilder

      public CustomLineItemBuilder()
  • Method Details

    • id

      public CustomLineItemBuilder id(String id)

      The unique ID of this CustomLineItem.

      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

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

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

      public CustomLineItemBuilder withMoney(Function<MoneyBuilder,Money> builder)
      set the value to the money using the builder function
      Parameters:
      builder - function to build the money value
      Returns:
      Builder
    • money

      public CustomLineItemBuilder money(Money money)
      set the value to the money
      Parameters:
      money - value to be set
      Returns:
      Builder
    • taxedPrice

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

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

      public CustomLineItemBuilder taxedPrice(TaxedItemPrice taxedPrice)
      set the value to the taxedPrice
      Parameters:
      taxedPrice - value to be set
      Returns:
      Builder
    • totalPrice

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

      public CustomLineItemBuilder withTotalPrice(Function<MoneyBuilder,Money> builder)
      set the value to the totalPrice using the builder function
      Parameters:
      builder - function to build the totalPrice value
      Returns:
      Builder
    • totalPrice

      public CustomLineItemBuilder totalPrice(Money totalPrice)
      set the value to the totalPrice
      Parameters:
      totalPrice - value to be set
      Returns:
      Builder
    • slug

      public CustomLineItemBuilder slug(String slug)

      A unique String in the cart to identify this CustomLineItem.

      Parameters:
      slug - value to be set
      Returns:
      Builder
    • quantity

      public CustomLineItemBuilder quantity(Integer quantity)

      The amount of a CustomLineItem in the cart. Must be a positive integer.

      Parameters:
      quantity - value to be set
      Returns:
      Builder
    • getId

      public String getId()

      The unique ID of this CustomLineItem.

      Returns:
      id
    • getName

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

      public Money getMoney()
      value of money}
      Returns:
      money
    • getTaxedPrice

      public TaxedItemPrice getTaxedPrice()
      value of taxedPrice}
      Returns:
      taxedPrice
    • getTotalPrice

      public Money getTotalPrice()
      value of totalPrice}
      Returns:
      totalPrice
    • getSlug

      public String getSlug()

      A unique String in the cart to identify this CustomLineItem.

      Returns:
      slug
    • getQuantity

      public Integer getQuantity()

      The amount of a CustomLineItem in the cart. Must be a positive integer.

      Returns:
      quantity
    • build

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

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

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

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