Class CartChangeLineItemQuantityActionBuilder

java.lang.Object
com.commercetools.api.models.cart.CartChangeLineItemQuantityActionBuilder
All Implemented Interfaces:
Builder<CartChangeLineItemQuantityAction>

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

     CartChangeLineItemQuantityAction cartChangeLineItemQuantityAction = CartChangeLineItemQuantityAction.builder()
             .quantity(0.3)
             .build()
 
  • Constructor Details

    • CartChangeLineItemQuantityActionBuilder

      public CartChangeLineItemQuantityActionBuilder()
  • Method Details

    • lineItemId

      id of the LineItem to update. Either lineItemId or lineItemKey is required.

      Parameters:
      lineItemId - value to be set
      Returns:
      Builder
    • lineItemKey

      public CartChangeLineItemQuantityActionBuilder lineItemKey(@Nullable String lineItemKey)

      key of the LineItem to update. Either lineItemId or lineItemKey is required.

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

      public CartChangeLineItemQuantityActionBuilder quantity(Long quantity)

      New value to set.

      If 0, the Line Item is removed from the Cart.

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

      Required when the Line Item uses ExternalPrice LineItemPriceMode. Sets the LineItem price to the given value when changing the quantity of a Line Item.

      The LineItem price is updated as described in Line Item price selection.

      Parameters:
      builder - function to build the externalPrice value
      Returns:
      Builder
    • withExternalPrice

      Required when the Line Item uses ExternalPrice LineItemPriceMode. Sets the LineItem price to the given value when changing the quantity of a Line Item.

      The LineItem price is updated as described in Line Item price selection.

      Parameters:
      builder - function to build the externalPrice value
      Returns:
      Builder
    • externalPrice

      public CartChangeLineItemQuantityActionBuilder externalPrice(@Nullable Money externalPrice)

      Required when the Line Item uses ExternalPrice LineItemPriceMode. Sets the LineItem price to the given value when changing the quantity of a Line Item.

      The LineItem price is updated as described in Line Item price selection.

      Parameters:
      externalPrice - value to be set
      Returns:
      Builder
    • externalTotalPrice

      Sets the LineItem price and totalPrice to the given value when changing the quantity of a Line Item with the ExternalTotal LineItemPriceMode. If externalTotalPrice is not given and the priceMode is ExternalTotal, the external price is unset and the priceMode is set to Platform.

      Parameters:
      builder - function to build the externalTotalPrice value
      Returns:
      Builder
    • withExternalTotalPrice

      Sets the LineItem price and totalPrice to the given value when changing the quantity of a Line Item with the ExternalTotal LineItemPriceMode. If externalTotalPrice is not given and the priceMode is ExternalTotal, the external price is unset and the priceMode is set to Platform.

      Parameters:
      builder - function to build the externalTotalPrice value
      Returns:
      Builder
    • externalTotalPrice

      public CartChangeLineItemQuantityActionBuilder externalTotalPrice(@Nullable ExternalLineItemTotalPrice externalTotalPrice)

      Sets the LineItem price and totalPrice to the given value when changing the quantity of a Line Item with the ExternalTotal LineItemPriceMode. If externalTotalPrice is not given and the priceMode is ExternalTotal, the external price is unset and the priceMode is set to Platform.

      Parameters:
      externalTotalPrice - value to be set
      Returns:
      Builder
    • getLineItemId

      @Nullable public String getLineItemId()

      id of the LineItem to update. Either lineItemId or lineItemKey is required.

      Returns:
      lineItemId
    • getLineItemKey

      @Nullable public String getLineItemKey()

      key of the LineItem to update. Either lineItemId or lineItemKey is required.

      Returns:
      lineItemKey
    • getQuantity

      public Long getQuantity()

      New value to set.

      If 0, the Line Item is removed from the Cart.

      Returns:
      quantity
    • getExternalPrice

      @Nullable public Money getExternalPrice()

      Required when the Line Item uses ExternalPrice LineItemPriceMode. Sets the LineItem price to the given value when changing the quantity of a Line Item.

      The LineItem price is updated as described in Line Item price selection.

      Returns:
      externalPrice
    • getExternalTotalPrice

      @Nullable public ExternalLineItemTotalPrice getExternalTotalPrice()

      Sets the LineItem price and totalPrice to the given value when changing the quantity of a Line Item with the ExternalTotal LineItemPriceMode. If externalTotalPrice is not given and the priceMode is ExternalTotal, the external price is unset and the priceMode is set to Platform.

      Returns:
      externalTotalPrice
    • build

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

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

      factory method for an instance of CartChangeLineItemQuantityActionBuilder
      Returns:
      builder
    • of

      create builder for CartChangeLineItemQuantityAction instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder