java.lang.Object
com.broadleafcommerce.cartoperation.domain.Variant
All Implemented Interfaces:
com.broadleafcommerce.money.jackson.CurrencyContextAware, Serializable

public class Variant extends Object implements Serializable, com.broadleafcommerce.money.jackson.CurrencyContextAware

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:
Chad Harchar (charchar)
See Also:
  • Constructor Details

    • Variant

      public Variant()
  • Method Details

    • addAdditionalAttribute

      public void addAdditionalAttribute(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
    • getAdditionalAttribute

      public Map<String,Object> getAdditionalAttribute()
      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
    • getName

      public String getName()
      The name of this particular variant of the product. Generally serves as an overridable field from a product. During option selection when narrowing the specific Sku to order
      Returns:
      the name of this variant
    • getPriceInfo

      public com.broadleafcommerce.pricing.client.domain.PriceInfo getPriceInfo()
      Summary of the pricing information related to the choice.
      Returns:
      Summary of the pricing information related to the choice
    • getOptionValues

      public Map<String,String> getOptionValues()
      Helper to make this particular variant uniquely identifiable across multiple variants for the same product. Keys correspond to AttributeChoice.getAttributeName() while values correspond to one of the corresponding AttributeChoice.getAttributeName().
      Returns:
      a map of option attribute names to a corresponding option value
    • getInventoryCheckStrategy

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

      public String getInventoryReservationStrategy()
      Describes when the variant's inventory should be reserved. If not set, defaults to Product.inventoryReservationStrategy.
      Returns:
      the variant's inventory reservation strategy
    • 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
    • getFulfillmentFlatRates

      public Map<String,FulfillmentFlatRate> getFulfillmentFlatRates()
      A map of flat rates for fulfilling (e.g., shipping) this product for a particular fulfillment option type (e.g., standard shipping). Depending on if the option is configured to use flat rates, this flat rate will be used in calculating the cost of fulfilling this product.

      The key of the map is the type of the fulfillment option such as FIXED_STANDARD or BANDED_PRICE_EXPRESS.

      Returns:
      Map of Fulfillment option types to flat rates for this product.
      See Also:
    • getWeight

      public Weight getWeight()
      Returns:
      the weight of this variant
    • getAttributes

      public Map<String,Serializable> getAttributes()
      Dynamic attributes that are a part of the variant.
      Returns:
      dynamic attributes that are a part of the variant
    • getCurrencyContext

      public com.broadleafcommerce.money.CurrencyContext getCurrencyContext()
      Transient ability to have a currency initialized
      Specified by:
      getCurrencyContext in interface com.broadleafcommerce.money.jackson.CurrencyContextAware
    • getAdditionalAttributes

      public Map<String,Object> getAdditionalAttributes()
      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
    • setName

      public void setName(String name)
      The name of this particular variant of the product. Generally serves as an overridable field from a product. During option selection when narrowing the specific Sku to order
      Parameters:
      name - the name of this variant
    • setPriceInfo

      public void setPriceInfo(com.broadleafcommerce.pricing.client.domain.PriceInfo priceInfo)
      Summary of the pricing information related to the choice.
      Parameters:
      priceInfo - Summary of the pricing information related to the choice
    • setOptionValues

      public void setOptionValues(Map<String,String> optionValues)
      Helper to make this particular variant uniquely identifiable across multiple variants for the same product. Keys correspond to AttributeChoice.getAttributeName() while values correspond to one of the corresponding AttributeChoice.getAttributeName().
      Parameters:
      optionValues - a map of option attribute names to a corresponding option value
    • setInventoryCheckStrategy

      public void setInventoryCheckStrategy(String inventoryCheckStrategy)
      Describes when the variant's inventory should be checked for availability. If not set, defaults to Product.inventoryCheckStrategy.
      Parameters:
      inventoryCheckStrategy - the variant's inventory check strategy
    • setInventoryReservationStrategy

      public void setInventoryReservationStrategy(String inventoryReservationStrategy)
      Describes when the variant's inventory should be reserved. If not set, defaults to Product.inventoryReservationStrategy.
      Parameters:
      inventoryReservationStrategy - the variant's inventory reservation strategy
    • 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
    • setFulfillmentFlatRates

      public void setFulfillmentFlatRates(Map<String,FulfillmentFlatRate> fulfillmentFlatRates)
      A map of flat rates for fulfilling (e.g., shipping) this product for a particular fulfillment option type (e.g., standard shipping). Depending on if the option is configured to use flat rates, this flat rate will be used in calculating the cost of fulfilling this product.

      The key of the map is the type of the fulfillment option such as FIXED_STANDARD or BANDED_PRICE_EXPRESS.

      Parameters:
      fulfillmentFlatRates - Map of Fulfillment option types to flat rates for this product.
      See Also:
    • setWeight

      public void setWeight(Weight weight)
      Parameters:
      weight - the weight of this variant
    • setAttributes

      public void setAttributes(Map<String,Serializable> attributes)
      Dynamic attributes that are a part of the variant.
      Parameters:
      attributes - dynamic attributes that are a part of the variant
    • setCurrencyContext

      public void setCurrencyContext(com.broadleafcommerce.money.CurrencyContext currencyContext)
      Transient ability to have a currency initialized
      Specified by:
      setCurrencyContext in interface com.broadleafcommerce.money.jackson.CurrencyContextAware
    • setAdditionalAttributes

      public void setAdditionalAttributes(Map<String,Object> additionalAttributes)
      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