Interface ProductVariant

All Superinterfaces:
AttributeContainer, WithKey

public interface ProductVariant extends AttributeContainer, WithKey

A concrete sellable good for which inventory can be tracked. Product Variants are generally mapped to specific SKUs.


Example to create an instance using the builder pattern

     ProductVariant productVariant = ProductVariant.builder()
             .id(0.3)
             .build()
 
  • Method Details

    • getId

      @NotNull @NotNull Long getId()

      A unique, sequential identifier of the Product Variant within the Product.

      Returns:
      id
    • getSku

      String getSku()

      User-defined unique SKU of the Product Variant.

      Returns:
      sku
    • getKey

      String getKey()

      User-defined unique identifier of the ProductVariant.

      This is different from Product key.

      Specified by:
      getKey in interface WithKey
      Returns:
      key
    • getPrices

      @Valid @Valid List<Price> getPrices()

      The Embedded Prices of the Product Variant. Cannot contain two Prices of the same Price scope (with same currency, country, Customer Group, Channel, validFrom and validUntil).

      Returns:
      prices
    • getAttributes

      @Valid @Valid List<Attribute> getAttributes()

      Attributes of the Product Variant.

      Specified by:
      getAttributes in interface AttributeContainer
      Returns:
      attributes
    • getPrice

      @Valid @Valid Price getPrice()

      Only available when Price selection is used. Cannot be used in a Query Predicate.

      Returns:
      price
    • getImages

      @Valid @Valid List<Image> getImages()

      Images of the Product Variant.

      Returns:
      images
    • getAssets

      @Valid @Valid List<Asset> getAssets()

      Media assets of the Product Variant.

      Returns:
      assets
    • getAvailability

      @Valid @Valid ProductVariantAvailability getAvailability()

      Set if the Product Variant is tracked by Inventory. Can be used as an optimization to reduce calls to the Inventory service. May not contain the latest Inventory State (it is eventually consistent).

      Returns:
      availability
    • getIsMatchingVariant

      Boolean getIsMatchingVariant()

      true if the Product Variant matches the search query. Only available in response to a Product Projection Search request.

      Returns:
      isMatchingVariant
    • getScopedPrice

      @Valid @Valid ScopedPrice getScopedPrice()

      Only available in response to a Product Projection Search request with price selection. Can be used to sort, filter, and facet.

      Returns:
      scopedPrice
    • getScopedPriceDiscounted

      Boolean getScopedPriceDiscounted()

      Only available in response to a Product Projection Search request with price selection.

      Returns:
      scopedPriceDiscounted
    • setId

      void setId(Long id)

      A unique, sequential identifier of the Product Variant within the Product.

      Parameters:
      id - value to be set
    • setSku

      void setSku(String sku)

      User-defined unique SKU of the Product Variant.

      Parameters:
      sku - value to be set
    • setKey

      void setKey(String key)

      User-defined unique identifier of the ProductVariant.

      This is different from Product key.

      Parameters:
      key - value to be set
    • setPrices

      void setPrices(Price... prices)

      The Embedded Prices of the Product Variant. Cannot contain two Prices of the same Price scope (with same currency, country, Customer Group, Channel, validFrom and validUntil).

      Parameters:
      prices - values to be set
    • setPrices

      void setPrices(List<Price> prices)

      The Embedded Prices of the Product Variant. Cannot contain two Prices of the same Price scope (with same currency, country, Customer Group, Channel, validFrom and validUntil).

      Parameters:
      prices - values to be set
    • setAttributes

      void setAttributes(Attribute... attributes)

      Attributes of the Product Variant.

      Parameters:
      attributes - values to be set
    • setAttributes

      void setAttributes(List<Attribute> attributes)

      Attributes of the Product Variant.

      Parameters:
      attributes - values to be set
    • setPrice

      void setPrice(Price price)

      Only available when Price selection is used. Cannot be used in a Query Predicate.

      Parameters:
      price - value to be set
    • setImages

      void setImages(Image... images)

      Images of the Product Variant.

      Parameters:
      images - values to be set
    • setImages

      void setImages(List<Image> images)

      Images of the Product Variant.

      Parameters:
      images - values to be set
    • setAssets

      void setAssets(Asset... assets)

      Media assets of the Product Variant.

      Parameters:
      assets - values to be set
    • setAssets

      void setAssets(List<Asset> assets)

      Media assets of the Product Variant.

      Parameters:
      assets - values to be set
    • setAvailability

      void setAvailability(ProductVariantAvailability availability)

      Set if the Product Variant is tracked by Inventory. Can be used as an optimization to reduce calls to the Inventory service. May not contain the latest Inventory State (it is eventually consistent).

      Parameters:
      availability - value to be set
    • setIsMatchingVariant

      void setIsMatchingVariant(Boolean isMatchingVariant)

      true if the Product Variant matches the search query. Only available in response to a Product Projection Search request.

      Parameters:
      isMatchingVariant - value to be set
    • setScopedPrice

      void setScopedPrice(ScopedPrice scopedPrice)

      Only available in response to a Product Projection Search request with price selection. Can be used to sort, filter, and facet.

      Parameters:
      scopedPrice - value to be set
    • setScopedPriceDiscounted

      void setScopedPriceDiscounted(Boolean scopedPriceDiscounted)

      Only available in response to a Product Projection Search request with price selection.

      Parameters:
      scopedPriceDiscounted - value to be set
    • of

      static ProductVariant of()
      factory method
      Returns:
      instance of ProductVariant
    • of

      static ProductVariant of(ProductVariant template)
      factory method to create a shallow copy ProductVariant
      Parameters:
      template - instance to be copied
      Returns:
      copy instance
    • deepCopy

      @Nullable static ProductVariant deepCopy(@Nullable ProductVariant template)
      factory method to create a deep copy of ProductVariant
      Parameters:
      template - instance to be copied
      Returns:
      copy instance
    • builder

      static ProductVariantBuilder builder()
      builder factory method for ProductVariant
      Returns:
      builder
    • builder

      static ProductVariantBuilder builder(ProductVariant template)
      create builder for ProductVariant instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder
    • withProductVariant

      default <T> T withProductVariant(Function<ProductVariant,T> helper)
      accessor map function
      Type Parameters:
      T - mapped type
      Parameters:
      helper - function to map the object
      Returns:
      mapped value
    • typeReference

      static com.fasterxml.jackson.core.type.TypeReference<ProductVariant> typeReference()
      gives a TypeReference for usage with Jackson DataBind
      Returns:
      TypeReference