Class ProductVariantImpl

java.lang.Object
com.commercetools.api.models.product.ProductVariantImpl
All Implemented Interfaces:
AttributeContainer, ProductVariant, WithKey, io.vrap.rmf.base.client.ModelBase

public class ProductVariantImpl extends Object implements ProductVariant, io.vrap.rmf.base.client.ModelBase

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

  • Constructor Details

    • ProductVariantImpl

      public ProductVariantImpl()
      create empty instance
  • Method Details

    • getId

      public Long getId()

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

      Specified by:
      getId in interface ProductVariant
      Returns:
      id
    • getSku

      public String getSku()

      User-defined unique SKU of the Product Variant.

      Specified by:
      getSku in interface ProductVariant
      Returns:
      sku
    • getKey

      public String getKey()

      User-defined unique identifier of the ProductVariant.

      This is different from Product key.

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

      public 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).

      Specified by:
      getPrices in interface ProductVariant
      Returns:
      prices
    • getAttributes

      public List<Attribute> getAttributes()

      Attributes of the Product Variant.

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

      public Price getPrice()

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

      Specified by:
      getPrice in interface ProductVariant
      Returns:
      price
    • getImages

      public List<Image> getImages()

      Images of the Product Variant.

      Specified by:
      getImages in interface ProductVariant
      Returns:
      images
    • getAssets

      public List<Asset> getAssets()

      Media assets of the Product Variant.

      Specified by:
      getAssets in interface ProductVariant
      Returns:
      assets
    • getAvailability

      public 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).

      Specified by:
      getAvailability in interface ProductVariant
      Returns:
      availability
    • getIsMatchingVariant

      public Boolean getIsMatchingVariant()

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

      Specified by:
      getIsMatchingVariant in interface ProductVariant
      Returns:
      isMatchingVariant
    • getScopedPrice

      public ScopedPrice getScopedPrice()

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

      Specified by:
      getScopedPrice in interface ProductVariant
      Returns:
      scopedPrice
    • getScopedPriceDiscounted

      public Boolean getScopedPriceDiscounted()

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

      Specified by:
      getScopedPriceDiscounted in interface ProductVariant
      Returns:
      scopedPriceDiscounted
    • setId

      public void setId(Long id)
      Description copied from interface: ProductVariant

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

      Specified by:
      setId in interface ProductVariant
      Parameters:
      id - value to be set
    • setSku

      public void setSku(String sku)
      Description copied from interface: ProductVariant

      User-defined unique SKU of the Product Variant.

      Specified by:
      setSku in interface ProductVariant
      Parameters:
      sku - value to be set
    • setKey

      public void setKey(String key)
      Description copied from interface: ProductVariant

      User-defined unique identifier of the ProductVariant.

      This is different from Product key.

      Specified by:
      setKey in interface ProductVariant
      Parameters:
      key - value to be set
    • setPrices

      public void setPrices(Price... prices)
      Description copied from interface: ProductVariant

      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).

      Specified by:
      setPrices in interface ProductVariant
      Parameters:
      prices - values to be set
    • setPrices

      public void setPrices(List<Price> prices)
      Description copied from interface: ProductVariant

      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).

      Specified by:
      setPrices in interface ProductVariant
      Parameters:
      prices - values to be set
    • setAttributes

      public void setAttributes(Attribute... attributes)
      Description copied from interface: ProductVariant

      Attributes of the Product Variant.

      Specified by:
      setAttributes in interface ProductVariant
      Parameters:
      attributes - values to be set
    • setAttributes

      public void setAttributes(List<Attribute> attributes)
      Description copied from interface: ProductVariant

      Attributes of the Product Variant.

      Specified by:
      setAttributes in interface ProductVariant
      Parameters:
      attributes - values to be set
    • setPrice

      public void setPrice(Price price)
      Description copied from interface: ProductVariant

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

      Specified by:
      setPrice in interface ProductVariant
      Parameters:
      price - value to be set
    • setImages

      public void setImages(Image... images)
      Description copied from interface: ProductVariant

      Images of the Product Variant.

      Specified by:
      setImages in interface ProductVariant
      Parameters:
      images - values to be set
    • setImages

      public void setImages(List<Image> images)
      Description copied from interface: ProductVariant

      Images of the Product Variant.

      Specified by:
      setImages in interface ProductVariant
      Parameters:
      images - values to be set
    • setAssets

      public void setAssets(Asset... assets)
      Description copied from interface: ProductVariant

      Media assets of the Product Variant.

      Specified by:
      setAssets in interface ProductVariant
      Parameters:
      assets - values to be set
    • setAssets

      public void setAssets(List<Asset> assets)
      Description copied from interface: ProductVariant

      Media assets of the Product Variant.

      Specified by:
      setAssets in interface ProductVariant
      Parameters:
      assets - values to be set
    • setAvailability

      public void setAvailability(ProductVariantAvailability availability)
      Description copied from interface: ProductVariant

      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).

      Specified by:
      setAvailability in interface ProductVariant
      Parameters:
      availability - value to be set
    • setIsMatchingVariant

      public void setIsMatchingVariant(Boolean isMatchingVariant)
      Description copied from interface: ProductVariant

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

      Specified by:
      setIsMatchingVariant in interface ProductVariant
      Parameters:
      isMatchingVariant - value to be set
    • setScopedPrice

      public void setScopedPrice(ScopedPrice scopedPrice)
      Description copied from interface: ProductVariant

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

      Specified by:
      setScopedPrice in interface ProductVariant
      Parameters:
      scopedPrice - value to be set
    • setScopedPriceDiscounted

      public void setScopedPriceDiscounted(Boolean scopedPriceDiscounted)
      Description copied from interface: ProductVariant

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

      Specified by:
      setScopedPriceDiscounted in interface ProductVariant
      Parameters:
      scopedPriceDiscounted - value to be set
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object