Class Variant
- 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
Productand only provide a link to theProductit is apart of because of this.- Author:
- Nathan Moore (nathandmoore)
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Variant()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAttribute(String name, Object value)Takes in any additional attributes passed in the request not matching any defined properties.protected booleancanEqual(Object other)booleanequals(Object o)Map<String,Object>getAttribute()Return any additional attributes passed in the request not matching any defined properties.Map<String,Object>getAttributes()Map holding any additional attributes passed in the request not matching any defined properties.javax.money.MonetaryAmountgetDefaultPrice()The default price that should be used if there is not asalePriceset.StringgetId()The unique identifier for this variant.IntegergetMaximumThreshold()The maximum count of this variant can be added in a cart.IntegergetMinimumThreshold()The minimum count of this variant that must be added in a cart.com.broadleafcommerce.pricing.client.domain.PriceInfogetPriceInfo()Summary of thepricing informationrelated to the variant.javax.money.MonetaryAmountgetSalePrice()Indicates that this product is on sale.StringgetSku()Sku code for this particular variant.StringgetVendorRef()Soft reference to the vendor associated with this catalog.inthashCode()voidsetAttributes(Map<String,Object> attributes)Map holding any additional attributes passed in the request not matching any defined properties.voidsetDefaultPrice(javax.money.MonetaryAmount defaultPrice)The default price that should be used if there is not asalePriceset.voidsetId(String id)The unique identifier for this variant.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.voidsetPriceInfo(com.broadleafcommerce.pricing.client.domain.PriceInfo priceInfo)Summary of thepricing informationrelated to the variant.voidsetSalePrice(javax.money.MonetaryAmount salePrice)Indicates that this product is on sale.voidsetSku(String sku)Sku code for this particular variant.voidsetVendorRef(String vendorRef)Soft reference to the vendor associated with this catalog.StringtoString()
-
-
-
Method Detail
-
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 attributevalue- 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 thepricing informationrelated to the variant.- Specified by:
getPriceInfoin interfacePriceable- Returns:
- The
PriceInfoon the entity.
-
getDefaultPrice
public javax.money.MonetaryAmount getDefaultPrice()
The default price that should be used if there is not asalePriceset. 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
-
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 thepricing informationrelated to the variant.- Specified by:
setPriceInfoin interfacePriceable- Parameters:
priceInfo- ThePriceInfoto set.
-
setDefaultPrice
public void setDefaultPrice(javax.money.MonetaryAmount defaultPrice)
The default price that should be used if there is not asalePriceset. 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
-
setAttributes
public void setAttributes(Map<String,Object> attributes)
Map holding any additional attributes passed in the request not matching any defined properties.
-
canEqual
protected boolean canEqual(Object other)
-
-