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 theProduct
it is apart of because of this.- Author:
- Chad Harchar (charchar)
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Variant()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAdditionalAttribute(String name, Object value)
Takes in any additional attributes passed in the request not matching any defined properties.protected boolean
canEqual(Object other)
boolean
equals(Object o)
Map<String,Object>
getAdditionalAttribute()
Return any additional attributes passed in the request not matching any defined properties.Map<String,Object>
getAdditionalAttributes()
Map holding any additional attributes passed in the request not matching any defined properties.Map<String,Serializable>
getAttributes()
Dynamic attributes that are a part of the variant.com.broadleafcommerce.money.CurrencyContext
getCurrencyContext()
Transient ability to have a currency initializedMap<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).String
getId()
The unique identifier for this variant.String
getInventoryCheckStrategy()
Describes when the variant's inventory should be checked for availability.String
getInventoryReservationStrategy()
Describes when the variant's inventory should be reserved.Integer
getMaximumThreshold()
The maximum count of this variant can be added in a cart.Integer
getMinimumThreshold()
The minimum count of this variant that must be added in a cart.String
getName()
The name of this particular variant of the product.Map<String,String>
getOptionValues()
Helper to make this particular variant uniquely identifiable across multiple variants for the same product.com.broadleafcommerce.pricing.client.domain.PriceInfo
getPriceInfo()
Summary of thepricing information
related to the choice.String
getSku()
Sku code for this particular variant.Weight
getWeight()
int
hashCode()
void
setAdditionalAttributes(Map<String,Object> additionalAttributes)
Map holding any additional attributes passed in the request not matching any defined properties.void
setAttributes(Map<String,Serializable> attributes)
Dynamic attributes that are a part of the variant.void
setCurrencyContext(com.broadleafcommerce.money.CurrencyContext currencyContext)
Transient ability to have a currency initializedvoid
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).void
setId(String id)
The unique identifier for this variant.void
setInventoryCheckStrategy(String inventoryCheckStrategy)
Describes when the variant's inventory should be checked for availability.void
setInventoryReservationStrategy(String inventoryReservationStrategy)
Describes when the variant's inventory should be reserved.void
setMaximumThreshold(Integer maximumThreshold)
The maximum count of this variant can be added in a cart.void
setMinimumThreshold(Integer minimumThreshold)
The minimum count of this variant that must be added in a cart.void
setName(String name)
The name of this particular variant of the product.void
setOptionValues(Map<String,String> optionValues)
Helper to make this particular variant uniquely identifiable across multiple variants for the same product.void
setPriceInfo(com.broadleafcommerce.pricing.client.domain.PriceInfo priceInfo)
Summary of thepricing information
related to the choice.void
setSku(String sku)
Sku code for this particular variant.void
setWeight(Weight weight)
String
toString()
-
-
-
Method Detail
-
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 attributevalue
- 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 thepricing 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 toAttributeChoice.getAttributeName()
while values correspond to one of the correspondingAttributeChoice.getAttributeName()
.- Returns:
- a map of
option attribute names
to a correspondingoption value
-
getInventoryCheckStrategy
public String 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
public String getInventoryReservationStrategy()
Describes when the variant's inventory should be reserved. If not set, defaults toProduct.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
orBANDED_PRICE_EXPRESS
.- Returns:
- Map of Fulfillment option types to flat rates for this product.
- See Also:
FulfillmentFlatRate
-
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 interfacecom.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 thepricing information
related to the choice.- Parameters:
priceInfo
- Summary of thepricing 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 toAttributeChoice.getAttributeName()
while values correspond to one of the correspondingAttributeChoice.getAttributeName()
.- Parameters:
optionValues
- a map ofoption attribute names
to a correspondingoption value
-
setInventoryCheckStrategy
public void setInventoryCheckStrategy(String inventoryCheckStrategy)
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
public void setInventoryReservationStrategy(String inventoryReservationStrategy)
Describes when the variant's inventory should be reserved. If not set, defaults toProduct.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
orBANDED_PRICE_EXPRESS
.- Parameters:
fulfillmentFlatRates
- Map of Fulfillment option types to flat rates for this product.- See Also:
FulfillmentFlatRate
-
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 interfacecom.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.
-
canEqual
protected boolean canEqual(Object other)
-
-