Class ShoppingListLineItemBuilder

java.lang.Object
com.commercetools.api.models.shopping_list.ShoppingListLineItemBuilder
All Implemented Interfaces:
Builder<ShoppingListLineItem>

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

     ShoppingListLineItem shoppingListLineItem = ShoppingListLineItem.builder()
             .addedAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .id("{id}")
             .name(nameBuilder -> nameBuilder)
             .productId("{productId}")
             .productType(productTypeBuilder -> productTypeBuilder)
             .quantity(0.3)
             .build()
 
  • Constructor Details

    • ShoppingListLineItemBuilder

      public ShoppingListLineItemBuilder()
  • Method Details

    • addedAt

      public ShoppingListLineItemBuilder addedAt(ZonedDateTime addedAt)

      Date and time (UTC) the ShoppingListLineItem was added to the ShoppingList.

      Parameters:
      addedAt - value to be set
      Returns:
      Builder
    • custom

      Custom Fields of the ShoppingListLineItem.

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

      Custom Fields of the ShoppingListLineItem.

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

      Custom Fields of the ShoppingListLineItem.

      Parameters:
      custom - value to be set
      Returns:
      Builder
    • deactivatedAt

      public ShoppingListLineItemBuilder deactivatedAt(@Nullable ZonedDateTime deactivatedAt)

      If the Product or Product Variant is deleted, deactivatedAt is the date and time (UTC) of deletion.

      This data is updated in an eventual consistent manner when the Product Variant cannot be ordered anymore.

      Parameters:
      deactivatedAt - value to be set
      Returns:
      Builder
    • id

      Unique identifier of the ShoppingListLineItem.

      Parameters:
      id - value to be set
      Returns:
      Builder
    • key

      User-defined identifier of the ShoppingListLineItem. It is unique per ShoppingList.

      Parameters:
      key - value to be set
      Returns:
      Builder
    • name

      Name of the Product.

      This data is updated in an eventual consistent manner when the Product's name changes.

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

      Name of the Product.

      This data is updated in an eventual consistent manner when the Product's name changes.

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

      Name of the Product.

      This data is updated in an eventual consistent manner when the Product's name changes.

      Parameters:
      name - value to be set
      Returns:
      Builder
    • productId

      public ShoppingListLineItemBuilder productId(String productId)

      Unique identifier of a Product.

      Parameters:
      productId - value to be set
      Returns:
      Builder
    • productType

      The Product Type defining the Attributes of the Product.

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

      The Product Type defining the Attributes of the Product.

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

      public ShoppingListLineItemBuilder productType(ProductTypeReference productType)

      The Product Type defining the Attributes of the Product.

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

      public ShoppingListLineItemBuilder quantity(Long quantity)

      Number of Products in the ShoppingListLineItem.

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

      public ShoppingListLineItemBuilder variantId(@Nullable Long variantId)

      id of the ProductVariant the ShoppingListLineItem refers to. If not set, the ShoppingListLineItem refers to the Master Variant.

      Parameters:
      variantId - value to be set
      Returns:
      Builder
    • variant

      Data of the ProductVariant.

      Returned when expanded using expand=lineItems[*].variant. You cannot expand only a single element of the array.

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

      Data of the ProductVariant.

      Returned when expanded using expand=lineItems[*].variant. You cannot expand only a single element of the array.

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

      Data of the ProductVariant.

      Returned when expanded using expand=lineItems[*].variant. You cannot expand only a single element of the array.

      Parameters:
      variant - value to be set
      Returns:
      Builder
    • productSlug

      Slug of the current ProductData.

      Returned when expanded using expand=lineItems[*].productSlug. You cannot expand only a single element of the array.

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

      Slug of the current ProductData.

      Returned when expanded using expand=lineItems[*].productSlug. You cannot expand only a single element of the array.

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

      public ShoppingListLineItemBuilder productSlug(@Nullable LocalizedString productSlug)

      Slug of the current ProductData.

      Returned when expanded using expand=lineItems[*].productSlug. You cannot expand only a single element of the array.

      Parameters:
      productSlug - value to be set
      Returns:
      Builder
    • getAddedAt

      public ZonedDateTime getAddedAt()

      Date and time (UTC) the ShoppingListLineItem was added to the ShoppingList.

      Returns:
      addedAt
    • getCustom

      @Nullable public CustomFields getCustom()

      Custom Fields of the ShoppingListLineItem.

      Returns:
      custom
    • getDeactivatedAt

      @Nullable public ZonedDateTime getDeactivatedAt()

      If the Product or Product Variant is deleted, deactivatedAt is the date and time (UTC) of deletion.

      This data is updated in an eventual consistent manner when the Product Variant cannot be ordered anymore.

      Returns:
      deactivatedAt
    • getId

      public String getId()

      Unique identifier of the ShoppingListLineItem.

      Returns:
      id
    • getKey

      @Nullable public String getKey()

      User-defined identifier of the ShoppingListLineItem. It is unique per ShoppingList.

      Returns:
      key
    • getName

      public LocalizedString getName()

      Name of the Product.

      This data is updated in an eventual consistent manner when the Product's name changes.

      Returns:
      name
    • getProductId

      public String getProductId()

      Unique identifier of a Product.

      Returns:
      productId
    • getProductType

      public ProductTypeReference getProductType()

      The Product Type defining the Attributes of the Product.

      Returns:
      productType
    • getQuantity

      public Long getQuantity()

      Number of Products in the ShoppingListLineItem.

      Returns:
      quantity
    • getVariantId

      @Nullable public Long getVariantId()

      id of the ProductVariant the ShoppingListLineItem refers to. If not set, the ShoppingListLineItem refers to the Master Variant.

      Returns:
      variantId
    • getVariant

      @Nullable public ProductVariant getVariant()

      Data of the ProductVariant.

      Returned when expanded using expand=lineItems[*].variant. You cannot expand only a single element of the array.

      Returns:
      variant
    • getProductSlug

      @Nullable public LocalizedString getProductSlug()

      Slug of the current ProductData.

      Returned when expanded using expand=lineItems[*].productSlug. You cannot expand only a single element of the array.

      Returns:
      productSlug
    • build

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

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

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

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