Class ProductAddPriceActionBuilder

java.lang.Object
com.commercetools.api.models.product.ProductAddPriceActionBuilder
All Implemented Interfaces:
Builder<ProductAddPriceAction>

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

     ProductAddPriceAction productAddPriceAction = ProductAddPriceAction.builder()
             .price(priceBuilder -> priceBuilder)
             .build()
 
  • Constructor Details

    • ProductAddPriceActionBuilder

      public ProductAddPriceActionBuilder()
  • Method Details

    • variantId

      public ProductAddPriceActionBuilder variantId(@Nullable Long variantId)

      The id of the ProductVariant to update.

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

      public ProductAddPriceActionBuilder sku(@Nullable String sku)

      The sku of the ProductVariant to update.

      Parameters:
      sku - value to be set
      Returns:
      Builder
    • price

      Embedded Price to add to the Product Variant.

      If the key of the Price is used by another Embedded Price on the ProductVariant, a DuplicatePriceKey error is returned.

      If this Embedded Price has the same price scope as an existing Embedded Price on the ProductVariant, a DuplicatePriceScope error is returned.

      If this Embedded Price has overlapping validity periods within the same price scope, an OverlappingPriceValidity error is returned. An Embedded Price without validity period does not conflict with an Embedded Price defined for a time period.

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

      Embedded Price to add to the Product Variant.

      If the key of the Price is used by another Embedded Price on the ProductVariant, a DuplicatePriceKey error is returned.

      If this Embedded Price has the same price scope as an existing Embedded Price on the ProductVariant, a DuplicatePriceScope error is returned.

      If this Embedded Price has overlapping validity periods within the same price scope, an OverlappingPriceValidity error is returned. An Embedded Price without validity period does not conflict with an Embedded Price defined for a time period.

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

      Embedded Price to add to the Product Variant.

      If the key of the Price is used by another Embedded Price on the ProductVariant, a DuplicatePriceKey error is returned.

      If this Embedded Price has the same price scope as an existing Embedded Price on the ProductVariant, a DuplicatePriceScope error is returned.

      If this Embedded Price has overlapping validity periods within the same price scope, an OverlappingPriceValidity error is returned. An Embedded Price without validity period does not conflict with an Embedded Price defined for a time period.

      Parameters:
      price - value to be set
      Returns:
      Builder
    • staged

      public ProductAddPriceActionBuilder staged(@Nullable Boolean staged)

      Whether only staged prices are updated. If false, both current and staged prices are updated.

      Parameters:
      staged - value to be set
      Returns:
      Builder
    • getVariantId

      @Nullable public Long getVariantId()

      The id of the ProductVariant to update.

      Returns:
      variantId
    • getSku

      @Nullable public String getSku()

      The sku of the ProductVariant to update.

      Returns:
      sku
    • getPrice

      public PriceDraft getPrice()

      Embedded Price to add to the Product Variant.

      If the key of the Price is used by another Embedded Price on the ProductVariant, a DuplicatePriceKey error is returned.

      If this Embedded Price has the same price scope as an existing Embedded Price on the ProductVariant, a DuplicatePriceScope error is returned.

      If this Embedded Price has overlapping validity periods within the same price scope, an OverlappingPriceValidity error is returned. An Embedded Price without validity period does not conflict with an Embedded Price defined for a time period.

      Returns:
      price
    • getStaged

      @Nullable public Boolean getStaged()

      Whether only staged prices are updated. If false, both current and staged prices are updated.

      Returns:
      staged
    • build

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

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

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

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