Class CartUpdateBuilder

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

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

     CartUpdate cartUpdate = CartUpdate.builder()
             .version(0.3)
             .plusActions(actionsBuilder -> actionsBuilder)
             .build()
 
  • Constructor Details

    • CartUpdateBuilder

      public CartUpdateBuilder()
  • Method Details

    • version

      public CartUpdateBuilder version(Long version)

      Expected version of the Cart on which the changes apply. If the expected version does not match the actual version, a ConcurrentModification error will be returned.

      Parameters:
      version - value to be set
      Returns:
      Builder
    • actions

      public CartUpdateBuilder actions(CartUpdateAction... actions)

      Update actions to be performed on the Cart.

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

      public CartUpdateBuilder actions(List<CartUpdateAction> actions)

      Update actions to be performed on the Cart.

      Parameters:
      actions - value to be set
      Returns:
      Builder
    • plusActions

      public CartUpdateBuilder plusActions(CartUpdateAction... actions)

      Update actions to be performed on the Cart.

      Parameters:
      actions - value to be set
      Returns:
      Builder
    • plusActions

      Update actions to be performed on the Cart.

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

      Update actions to be performed on the Cart.

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

      public Long getVersion()

      Expected version of the Cart on which the changes apply. If the expected version does not match the actual version, a ConcurrentModification error will be returned.

      Returns:
      version
    • getActions

      public List<CartUpdateAction> getActions()

      Update actions to be performed on the Cart.

      Returns:
      actions
    • build

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

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

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

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