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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addAdditionalAttribute
(String name, Object value) Takes in any additional attributes passed in the request not matching any defined properties.protected boolean
boolean
Return 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.CurrencyContext
Transient 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.PriceInfo
Summary of thepricing information
related to the choice.getSku()
Sku code for this particular variant.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
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
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
Sku code for this particular variant.void
toString()
-
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 information
related to the choice.- Returns:
- Summary of the
pricing information
related 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 names
to 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_STANDARD
orBANDED_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:
getCurrencyContext
in 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 information
related to the choice.- Parameters:
priceInfo
- Summary of thepricing information
related 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 names
to 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_STANDARD
orBANDED_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:
setCurrencyContext
in 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
-