java.lang.Object
com.broadleafcommerce.catalogbrowse.domain.Variant
All Implemented Interfaces:
Priceable, Serializable

public class Variant extends Object implements Serializable, Priceable

Variants can help further identify the specifics of a Product by narrowing down the Sku via additional user data.

Variants are only intended to be accessed within the context of a Product and only provide a link to the Product it is apart of because of this.

Author:
Nathan Moore (nathandmoore)
See Also:
  • Constructor Details

    • Variant

      public Variant()
  • Method Details

    • addAttribute

      public void addAttribute(String name, Object value)
      Takes in any additional attributes passed in the request not matching any defined properties.
      Parameters:
      name - Name of the additional attribute
      value - Value of the additional attribute
    • getAttribute

      public Map<String,Object> getAttribute()
      Return any additional attributes passed in the request not matching any defined properties.
      Returns:
      any additional attributes passed in the request not matching any defined properties.
    • getId

      public String getId()
      The unique identifier for this variant.
      Returns:
      the context ID of the variant
    • getSku

      public String getSku()
      Sku code for this particular variant. Overrides the main Product Sku that is set, if any
      Returns:
      the SKU code for this variant
    • getPriceInfo

      public com.broadleafcommerce.pricing.client.domain.PriceInfo getPriceInfo()
      Summary of the pricing information related to the variant.
      Specified by:
      getPriceInfo in interface Priceable
      Returns:
      The PriceInfo on the entity.
    • getDefaultPrice

      public javax.money.MonetaryAmount getDefaultPrice()
      The default price that should be used if there is not a salePrice set. If this price is not set, product's price would be used.
      Returns:
      the default price to be used for this variant
    • getSalePrice

      public javax.money.MonetaryAmount getSalePrice()
      Indicates that this product is on sale. This should take priority over the default price if the default price is higher
      Returns:
      the sale price of this variant, indicating it is on sale
    • getVendorRef

      public String getVendorRef()
      Soft reference to the vendor associated with this catalog. This value can be null, in which case, no vendor is associated.
      Returns:
      Soft reference to the vendor associated with this catalog.
    • getMinimumThreshold

      public Integer getMinimumThreshold()
      The minimum count of this variant that must be added in a cart.
      Returns:
      the minimum count of this variant that must be added in a cart
    • getMaximumThreshold

      public Integer getMaximumThreshold()
      The maximum count of this variant can be added in a cart.
      Returns:
      the maximum count of this variant can be added in a cart
    • getInventoryCheckStrategy

      public String getInventoryCheckStrategy()
      Describes when the variant's inventory should be checked for availability. If not set, defaults to Product.getInventoryCheckStrategy().
      Returns:
      the inventory check strategy, or null.
    • getInventoryReservationStrategy

      public String getInventoryReservationStrategy()
      Describes when the variant's inventory should be reserved. If not set, defaults to Product.getInventoryReservationStrategy().
      Returns:
      the inventory reservation strategy, or null.
    • getAvailabilitySummary

      @Nullable public SkuInventoryAvailabilitySummary getAvailabilitySummary()
      A summary of inventory availability for this product's SKU.
    • getAttributes

      public Map<String,Object> getAttributes()
      Map holding any additional attributes passed in the request not matching any defined properties.
    • setId

      public void setId(String id)
      The unique identifier for this variant.
      Parameters:
      id - the context ID of the variant
    • setSku

      public void setSku(String sku)
      Sku code for this particular variant. Overrides the main Product Sku that is set, if any
      Parameters:
      sku - the SKU code for this variant
    • setPriceInfo

      public void setPriceInfo(com.broadleafcommerce.pricing.client.domain.PriceInfo priceInfo)
      Summary of the pricing information related to the variant.
      Specified by:
      setPriceInfo in interface Priceable
      Parameters:
      priceInfo - The PriceInfo to set.
    • setDefaultPrice

      public void setDefaultPrice(javax.money.MonetaryAmount defaultPrice)
      The default price that should be used if there is not a salePrice set. If this price is not set, product's price would be used.
      Parameters:
      defaultPrice - the default price to be used for this variant
    • setSalePrice

      public void setSalePrice(javax.money.MonetaryAmount salePrice)
      Indicates that this product is on sale. This should take priority over the default price if the default price is higher
      Parameters:
      salePrice - the sale price of this variant, indicating it is on sale
    • setVendorRef

      public void setVendorRef(String vendorRef)
      Soft reference to the vendor associated with this catalog. This value can be null, in which case, no vendor is associated.
      Parameters:
      vendorRef - Soft reference to the vendor associated with this catalog.
    • setMinimumThreshold

      public void setMinimumThreshold(Integer minimumThreshold)
      The minimum count of this variant that must be added in a cart.
      Parameters:
      minimumThreshold - the minimum count of this variant that must be added in a cart
    • setMaximumThreshold

      public void setMaximumThreshold(Integer maximumThreshold)
      The maximum count of this variant can be added in a cart.
      Parameters:
      maximumThreshold - the maximum count of this variant can be added in a cart
    • setInventoryCheckStrategy

      public void setInventoryCheckStrategy(String inventoryCheckStrategy)
      Describes when the variant's inventory should be checked for availability. If not set, defaults to Product.getInventoryCheckStrategy().
      Parameters:
      inventoryCheckStrategy - The inventoryCheckStrategy if/when inventory should be checked, usually during browsing
    • setInventoryReservationStrategy

      public void setInventoryReservationStrategy(String inventoryReservationStrategy)
      Describes when the variant's inventory should be reserved. If not set, defaults to Product.getInventoryReservationStrategy().
      Parameters:
      inventoryReservationStrategy - the strategy for reserving inventory
    • setAvailabilitySummary

      public void setAvailabilitySummary(@Nullable SkuInventoryAvailabilitySummary availabilitySummary)
      A summary of inventory availability for this product's SKU.
    • setAttributes

      public void setAttributes(Map<String,Object> attributes)
      Map holding any additional attributes passed in the request not matching any defined properties.
    • equals

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

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object