Class ProductOption
- java.lang.Object
-
- com.broadleafcommerce.cartoperation.domain.ProductOption
-
- All Implemented Interfaces:
Serializable
public class ProductOption extends Object implements Serializable
A "product option" encapsulates additional, variable information about aProduct
explicitly designed for customer-facing input. This can be info necessary for distinguishing particularvariants
such as shirt size, color, or material, or it can be some custom user-input such as a name to emboss on the back of a jersey. Finally, it can even drive additional products that should be added to the cart along with the product that it is configured for.- Author:
- Chad Harchar (charchar)
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ProductOption()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAttribute(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>
getAttribute()
Return any additional attributes passed in the request not matching any defined properties.AttributeChoice
getAttributeChoice()
Configuration when thetype
of this option is one of:ProductOptionType.VARIANT_DISTINGUISHING
- drives customer further specifying their choices into a specificVariant
that contains a unique SKU code, pricing concerns, etc.ProductOptionType.CART_ITEM_ATTRIBUTE
- Customer input will flow directly in the item attributes within their cartProductOptionType.CART_ATTRIBUTE
.Map<String,Object>
getAttributes()
Map holding any additional attributes passed in the request not matching any defined properties.ItemChoice
getItemChoice()
Configuration for theProductOptionType.ITEM_CHOICE
.String
getLabel()
The label shown to customers when displaying this option.String
getType()
Controls both how the customer should be inputting values to fill out this option as well as storage of where the value will go once added to the cart.int
hashCode()
void
setAttributeChoice(AttributeChoice attributeChoice)
Configuration when thetype
of this option is one of:ProductOptionType.VARIANT_DISTINGUISHING
- drives customer further specifying their choices into a specificVariant
that contains a unique SKU code, pricing concerns, etc.ProductOptionType.CART_ITEM_ATTRIBUTE
- Customer input will flow directly in the item attributes within their cartProductOptionType.CART_ATTRIBUTE
.void
setAttributes(Map<String,Object> attributes)
Map holding any additional attributes passed in the request not matching any defined properties.void
setItemChoice(ItemChoice itemChoice)
Configuration for theProductOptionType.ITEM_CHOICE
.void
setLabel(String label)
The label shown to customers when displaying this option.void
setType(String type)
Controls both how the customer should be inputting values to fill out this option as well as storage of where the value will go once added to the cart.String
toString()
-
-
-
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.
-
getType
public String getType()
Controls both how the customer should be inputting values to fill out this option as well as storage of where the value will go once added to the cart.- Returns:
- which type of input this option is configured for
- See Also:
ProductOptionType
-
getLabel
public String getLabel()
The label shown to customers when displaying this option. This helps communicate to customers how they should fill out the input- Returns:
- the display shown to customer for this option
-
getItemChoice
public ItemChoice getItemChoice()
Configuration for theProductOptionType.ITEM_CHOICE
. Drives customer selection of an additional item to add to their cart- Returns:
- configuration if the type of this option is an
ProductOptionType.ITEM_CHOICE
, otherwise null
-
getAttributeChoice
public AttributeChoice getAttributeChoice()
Configuration when the
type
of this option is one of:ProductOptionType.VARIANT_DISTINGUISHING
- drives customer further specifying their choices into a specificVariant
that contains a unique SKU code, pricing concerns, etc.ProductOptionType.CART_ITEM_ATTRIBUTE
- Customer input will flow directly in the item attributes within their cartProductOptionType.CART_ATTRIBUTE
. Customer input will flow directly in the global cart attribute. Any previously-set attribute should be replaced with new values.
- Returns:
- attributeChoice if the type of this option is an
ProductOptionType.VARIANT_DISTINGUISHING
,ProductOptionType.CART_ITEM_ATTRIBUTE
orProductOptionType.CART_ATTRIBUTE
, otherwise null
-
getAttributes
public Map<String,Object> getAttributes()
Map holding any additional attributes passed in the request not matching any defined properties.
-
setType
public void setType(String type)
Controls both how the customer should be inputting values to fill out this option as well as storage of where the value will go once added to the cart.- Parameters:
type
- the type of input that the drives customer selection, defaults fromProductOptionType
- See Also:
ProductOptionType
-
setLabel
public void setLabel(String label)
The label shown to customers when displaying this option. This helps communicate to customers how they should fill out the input- Parameters:
label
- the display shown to customers for this option
-
setItemChoice
public void setItemChoice(ItemChoice itemChoice)
Configuration for theProductOptionType.ITEM_CHOICE
. Drives customer selection of an additional item to add to their cart- Parameters:
itemChoice
- configuration only whentype
isProductOptionType.ITEM_CHOICE
-
setAttributeChoice
public void setAttributeChoice(AttributeChoice attributeChoice)
Configuration when the
type
of this option is one of:ProductOptionType.VARIANT_DISTINGUISHING
- drives customer further specifying their choices into a specificVariant
that contains a unique SKU code, pricing concerns, etc.ProductOptionType.CART_ITEM_ATTRIBUTE
- Customer input will flow directly in the item attributes within their cartProductOptionType.CART_ATTRIBUTE
. Customer input will flow directly in the global cart attribute. Any previously-set attribute should be replaced with new values.
- Parameters:
attributeChoice
- configuration for customer-driven values that flow into an attribute
-
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)
-
-