Class Variant
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAdditionalAttribute(String name, Object value) Takes in any additional attributes passed in the request not matching any defined properties.protected booleanbooleanReturn any additional attributes passed in the request not matching any defined properties.Map holding any additional attributes passed in the request not matching any defined properties.Dynamic attributes that are a part of the variant.com.broadleafcommerce.money.CurrencyContextTransient ability to have a currency initializedA map of flat rates for fulfilling (e.g., shipping) this product for a particular fulfillment option type (e.g., standard shipping).getId()The unique identifier for this variant.Describes when the variant's inventory should be checked for availability.Describes when the variant's inventory should be reserved.The maximum count of this variant can be added in a cart.The minimum count of this variant that must be added in a cart.getName()The name of this particular variant of the product.Helper to make this particular variant uniquely identifiable across multiple variants for the same product.com.broadleafcommerce.pricing.client.domain.PriceInfoSummary of thepricing informationrelated to the choice.getSku()Sku code for this particular variant.inthashCode()voidsetAdditionalAttributes(Map<String, Object> additionalAttributes) Map holding any additional attributes passed in the request not matching any defined properties.voidsetAttributes(Map<String, Serializable> attributes) Dynamic attributes that are a part of the variant.voidsetCurrencyContext(com.broadleafcommerce.money.CurrencyContext currencyContext) Transient ability to have a currency initializedvoidsetFulfillmentFlatRates(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).voidThe unique identifier for this variant.voidsetInventoryCheckStrategy(String inventoryCheckStrategy) Describes when the variant's inventory should be checked for availability.voidsetInventoryReservationStrategy(String inventoryReservationStrategy) Describes when the variant's inventory should be reserved.voidsetMaximumThreshold(Integer maximumThreshold) The maximum count of this variant can be added in a cart.voidsetMinimumThreshold(Integer minimumThreshold) The minimum count of this variant that must be added in a cart.voidThe name of this particular variant of the product.voidsetOptionValues(Map<String, String> optionValues) Helper to make this particular variant uniquely identifiable across multiple variants for the same product.voidsetPriceInfo(com.broadleafcommerce.pricing.client.domain.PriceInfo priceInfo) Summary of thepricing informationrelated to the choice.voidSku code for this particular variant.voidtoString()
-
Constructor Details
-
Variant
public Variant()
-
-
Method Details
-
addAdditionalAttribute
Takes in any additional attributes passed in the request not matching any defined properties.- Parameters:
name- Name of the additional attributevalue- Value of the additional attribute
-
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
The unique identifier for this variant.- Returns:
- the context ID of the variant
-
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
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 thepricing informationrelated to the choice.- Returns:
- Summary of the
pricing informationrelated to the choice
-
getOptionValues
Helper to make this particular variant uniquely identifiable across multiple variants for the same product. Keys correspond toAttributeChoice.getAttributeName()while values correspond to one of the correspondingAttributeChoice.getAttributeName().- Returns:
- a map of
option attribute namesto a correspondingoption value
-
getInventoryCheckStrategy
Describes when the variant's inventory should be checked for availability. If not set, defaults toProduct.inventoryCheckStrategy.- Returns:
- the variant's inventory check strategy
-
getInventoryReservationStrategy
Describes when the variant's inventory should be reserved. If not set, defaults toProduct.inventoryReservationStrategy.- Returns:
- the variant's inventory reservation strategy
-
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
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
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_STANDARDorBANDED_PRICE_EXPRESS.- Returns:
- Map of Fulfillment option types to flat rates for this product.
- See Also:
-
getWeight
- Returns:
- the weight of this variant
-
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:
getCurrencyContextin interfacecom.broadleafcommerce.money.jackson.CurrencyContextAware
-
getAdditionalAttributes
Map holding any additional attributes passed in the request not matching any defined properties. -
setId
The unique identifier for this variant.- Parameters:
id- the context ID of the variant
-
setSku
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
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 thepricing informationrelated to the choice.- Parameters:
priceInfo- Summary of thepricing informationrelated to the choice
-
setOptionValues
Helper to make this particular variant uniquely identifiable across multiple variants for the same product. Keys correspond toAttributeChoice.getAttributeName()while values correspond to one of the correspondingAttributeChoice.getAttributeName().- Parameters:
optionValues- a map ofoption attribute namesto a correspondingoption value
-
setInventoryCheckStrategy
Describes when the variant's inventory should be checked for availability. If not set, defaults toProduct.inventoryCheckStrategy.- Parameters:
inventoryCheckStrategy- the variant's inventory check strategy
-
setInventoryReservationStrategy
Describes when the variant's inventory should be reserved. If not set, defaults toProduct.inventoryReservationStrategy.- Parameters:
inventoryReservationStrategy- the variant's inventory reservation strategy
-
setMinimumThreshold
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
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
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_STANDARDorBANDED_PRICE_EXPRESS.- Parameters:
fulfillmentFlatRates- Map of Fulfillment option types to flat rates for this product.- See Also:
-
setWeight
- Parameters:
weight- the weight of this variant
-
setAttributes
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:
setCurrencyContextin interfacecom.broadleafcommerce.money.jackson.CurrencyContextAware
-
setAdditionalAttributes
Map holding any additional attributes passed in the request not matching any defined properties. -
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-