Class ItemChoice
- All Implemented Interfaces:
Serializable
DefaultProductOptionType.ITEM_CHOICE
.- Author:
- Phillip Verheyden (phillipuniverse)
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
boolean
<T> T
getAttribute
(String name) Miscellaneous attributes for this tag.TheCategory
which the choice will be chosen from by the customer if thetargetType
isDefaultItemChoiceTargetType.CATEGORY
.The key used during the validation of cart item's configuration to relate thisItemChoice
to one of the cart item's dependent items.javax.money.MonetaryAmount
Gets the default price as appropriate for thetargetType
.The default product that can be used when driving customer selections if thetargetType
isDefaultItemChoiceTargetType.SPECIFIC_PRODUCTS
.The default product that can be used when driving customer selections if thetargetType
isDefaultItemChoiceTargetType.CATEGORY
.The default variant that can be used when driving customer selections if thetargetType
isDefaultItemChoiceTargetType.SPECIFIC_VARIANTS
.protected javax.money.MonetaryAmount
The maximum amount of this item that a customer can purchase at a time.The minimum amount of the item that a customer must purchase.javax.money.MonetaryAmount
The price of this choice.System-wide unique identifier to configure specific pricing for the choice.Describes restrictions placed on the customer's ability to select items from the targeted set.If thetargetType
isDefaultItemChoiceTargetType.SPECIFIC_PRODUCTS
orDefaultItemChoiceTargetType.SPECIFIC_VARIANTS
this holds the manually-curated options that the customer can choose from.If thetargetType
isDefaultItemChoiceTargetType.SPECIFIC_PRODUCT
orDefaultItemChoiceTargetType.SPECIFIC_VARIANT
this holds the manually selected option that the customer can choose to add on.Identifies the type of items that a customer can choose from, whether specific products, specific variants, or products from a specific category.int
hashCode()
boolean
void
setAttributes
(Map<String, Object> attributes) Miscellaneous attributes for this tag.void
setCategory
(Category category) TheCategory
which the choice will be chosen from by the customer if thetargetType
isDefaultItemChoiceTargetType.CATEGORY
.void
setChoiceKey
(String choiceKey) The key used during the validation of cart item's configuration to relate thisItemChoice
to one of the cart item's dependent items.void
setDefaultProduct
(Product defaultProduct) The default product that can be used when driving customer selections if thetargetType
isDefaultItemChoiceTargetType.SPECIFIC_PRODUCTS
.void
setDefaultProductInCategory
(Product defaultProductInCategory) The default product that can be used when driving customer selections if thetargetType
isDefaultItemChoiceTargetType.CATEGORY
.void
setDefaultVariant
(Variant defaultVariant) The default variant that can be used when driving customer selections if thetargetType
isDefaultItemChoiceTargetType.SPECIFIC_VARIANTS
.void
setDiscountAllowed
(boolean discountAllowed) Dictates whether or not discounts are allowed to be applied to this choice.void
setMaximumQuantity
(Integer maximumQuantity) The maximum amount of this item that a customer can purchase at a time.void
setMinimumQuantity
(Integer minimumQuantity) The minimum amount of the item that a customer must purchase.void
setOverridePrice
(javax.money.MonetaryAmount overridePrice) The price of this choice.void
setPricingKey
(String pricingKey) System-wide unique identifier to configure specific pricing for the choice.void
setSelectionType
(String selectionType) Describes restrictions placed on the customer's ability to select items from the targeted set.void
setSpecificChoices
(List<SpecificItemChoice> specificChoices) If thetargetType
isDefaultItemChoiceTargetType.SPECIFIC_PRODUCTS
orDefaultItemChoiceTargetType.SPECIFIC_VARIANTS
this holds the manually-curated options that the customer can choose from.void
setSpecificItemChoice
(SpecificItemChoice specificItemChoice) If thetargetType
isDefaultItemChoiceTargetType.SPECIFIC_PRODUCT
orDefaultItemChoiceTargetType.SPECIFIC_VARIANT
this holds the manually selected option that the customer can choose to add on.void
setTargetType
(String targetType) Identifies the type of items that a customer can choose from, whether specific products, specific variants, or products from a specific category.toString()
-
Constructor Details
-
ItemChoice
public ItemChoice()
-
-
Method Details
-
getAttribute
-
getDefaultPrice
public javax.money.MonetaryAmount getDefaultPrice()Gets the default price as appropriate for thetargetType
.- Returns:
- The default price as appropriate for the
targetType
.
-
getFirstChoicesDefaultPrice
protected javax.money.MonetaryAmount getFirstChoicesDefaultPrice() -
isDiscountAllowed
public boolean isDiscountAllowed() -
getTargetType
Identifies the type of items that a customer can choose from, whether specific products, specific variants, or products from a specific category.- Returns:
- the
DefaultItemChoiceTargetType
of this item choice - See Also:
-
getSelectionType
Describes restrictions placed on the customer's ability to select items from the targeted set. Generally, this is a restriction on how many choices can be selected for a single add-to-cart request and, potentially, how quantity is distributed among multiple selected choices.- Returns:
- the
DefaultItemChoiceSelectionType
of this item choice - See Also:
-
getChoiceKey
The key used during the validation of cart item's configuration to relate thisItemChoice
to one of the cart item's dependent items.- Returns:
- The key used during the validation of cart item's configuration to relate this
ItemChoice
to one of the cart item's dependent items.
-
getMaximumQuantity
The maximum amount of this item that a customer can purchase at a time. If null, this would allow a customer to specify their own quantity for how many of these items they can add to the cart.- Returns:
- the maximum quantity of the choice's target product(s) that can be added
-
getMinimumQuantity
The minimum amount of the item that a customer must purchase.- Returns:
- the minimum quantity of the choice's target product(s)
-
getOverridePrice
public javax.money.MonetaryAmount getOverridePrice()The price of this choice. If no pricing is specified here, the price of the target
product
,getDefaultVariant()
() variant}, or selected product from thecategory
will be used.If this is a
DefaultItemChoiceTargetType.SPECIFIC_PRODUCTS
orDefaultItemChoiceTargetType.SPECIFIC_VARIANTS
then any price set here will be overridden by the item pricing set on any of thespecificChoices
for that choice.- Returns:
- the price of this choice
-
getPricingKey
System-wide unique identifier to configure specific pricing for the choice. Relevant if pricing data is managed in a separate system or data store, like the Broadleaf pricing services.- Returns:
- a unique key to identify this choice
-
getCategory
TheCategory
which the choice will be chosen from by the customer if thetargetType
isDefaultItemChoiceTargetType.CATEGORY
.- Returns:
- the category from which the choice will be chosen from or {@link null} if
targetType
is notDefaultItemChoiceTargetType.CATEGORY
-
getDefaultProductInCategory
The default product that can be used when driving customer selections if thetargetType
isDefaultItemChoiceTargetType.CATEGORY
.- Returns:
- the defaulted selection for this choice if the
targetType
isDefaultItemChoiceTargetType.CATEGORY
, null otherwise or if there is no default selection
-
getDefaultProduct
The default product that can be used when driving customer selections if thetargetType
isDefaultItemChoiceTargetType.SPECIFIC_PRODUCTS
. Can be null.- Returns:
- the defaulted selection for this choice if the
targetType
isDefaultItemChoiceTargetType.SPECIFIC_PRODUCTS
, null otherwise or if there is no default selection
-
getDefaultVariant
The default variant that can be used when driving customer selections if thetargetType
isDefaultItemChoiceTargetType.SPECIFIC_VARIANTS
. Can be null.- Returns:
- the defaulted selection for this choice if the
targetType
isDefaultItemChoiceTargetType.SPECIFIC_VARIANTS
, null otherwise or if there is no default selection
-
getSpecificChoices
If thetargetType
isDefaultItemChoiceTargetType.SPECIFIC_PRODUCTS
orDefaultItemChoiceTargetType.SPECIFIC_VARIANTS
this holds the manually-curated options that the customer can choose from. This also allows for specific override pricing on an item-by-item basis- Returns:
- the explicit choices for
DefaultItemChoiceTargetType.SPECIFIC_PRODUCTS
orDefaultItemChoiceTargetType.SPECIFIC_VARIANTS
value of thetargetType
-
getSpecificItemChoice
If thetargetType
isDefaultItemChoiceTargetType.SPECIFIC_PRODUCT
orDefaultItemChoiceTargetType.SPECIFIC_VARIANT
this holds the manually selected option that the customer can choose to add on. This also allows for specific override pricing.- Returns:
- the explicit choice for
DefaultItemChoiceTargetType.SPECIFIC_PRODUCT
orDefaultItemChoiceTargetType.SPECIFIC_VARIANT
value of thetargetType
-
getAttributes
Miscellaneous attributes for this tag.- Returns:
- Miscellaneous attributes for this tag.
-
setTargetType
Identifies the type of items that a customer can choose from, whether specific products, specific variants, or products from a specific category.- Parameters:
targetType
- theDefaultItemChoiceTargetType
of this item choice- See Also:
-
setSelectionType
Describes restrictions placed on the customer's ability to select items from the targeted set. Generally, this is a restriction on how many choices can be selected for a single add-to-cart request and, potentially, how quantity is distributed among multiple selected choices.- Parameters:
selectionType
- theDefaultItemChoiceSelectionType
of this item choice- See Also:
-
setChoiceKey
The key used during the validation of cart item's configuration to relate thisItemChoice
to one of the cart item's dependent items.- Parameters:
choiceKey
- The key used during the validation of cart item's configuration to relate thisItemChoice
to one of the cart item's dependent items.
-
setMaximumQuantity
The maximum amount of this item that a customer can purchase at a time. If null, this would allow a customer to specify their own quantity for how many of these items they can add to the cart.- Parameters:
maximumQuantity
- the maximum quantity of the choice's target product(s) that can be added
-
setMinimumQuantity
The minimum amount of the item that a customer must purchase.- Parameters:
minimumQuantity
- the minimum quantity of the choice's target product(s)
-
setOverridePrice
public void setOverridePrice(javax.money.MonetaryAmount overridePrice) The price of this choice. If no pricing is specified here, the price of the target
product
,getDefaultVariant()
() variant}, or selected product from thecategory
will be used.If this is a
DefaultItemChoiceTargetType.SPECIFIC_PRODUCTS
orDefaultItemChoiceTargetType.SPECIFIC_VARIANTS
then any price set here will be overridden by the item pricing set on any of thespecificChoices
for that choice.- Parameters:
overridePrice
- the price of this choice
-
setDiscountAllowed
public void setDiscountAllowed(boolean discountAllowed) Dictates whether or not discounts are allowed to be applied to this choice.- Parameters:
discountAllowed
- true if discounts are allowed to be applied to this choice, false otherwise
-
setPricingKey
System-wide unique identifier to configure specific pricing for the choice. Relevant if pricing data is managed in a separate system or data store, like the Broadleaf pricing services.- Parameters:
pricingKey
- a unique key to identify this choice (usually a UUID)
-
setCategory
TheCategory
which the choice will be chosen from by the customer if thetargetType
isDefaultItemChoiceTargetType.CATEGORY
.- Parameters:
category
- the category from which the choice will be chosen from
-
setDefaultProductInCategory
The default product that can be used when driving customer selections if thetargetType
isDefaultItemChoiceTargetType.CATEGORY
.- Parameters:
defaultProduct
- the default product that is automatically selected when thetargetType
isDefaultItemChoiceTargetType.CATEGORY
. Should come from within thecategory
-
setDefaultProduct
The default product that can be used when driving customer selections if thetargetType
isDefaultItemChoiceTargetType.SPECIFIC_PRODUCTS
. Can be null.- Parameters:
defaultProduct
- the default product that is automatically selected when thetargetType
is {DefaultItemChoiceTargetType.SPECIFIC_PRODUCTS
. Should come from the specific set of products inspecificChoices
-
setDefaultVariant
The default variant that can be used when driving customer selections if thetargetType
isDefaultItemChoiceTargetType.SPECIFIC_VARIANTS
. Can be null.- Parameters:
defaultVariant
- the default variant that is automatically selected when thetargetType
isDefaultItemChoiceTargetType.SPECIFIC_VARIANTS
. Should come from the explicit set of variants inspecificChoices
-
setSpecificChoices
If thetargetType
isDefaultItemChoiceTargetType.SPECIFIC_PRODUCTS
orDefaultItemChoiceTargetType.SPECIFIC_VARIANTS
this holds the manually-curated options that the customer can choose from. This also allows for specific override pricing on an item-by-item basis- Parameters:
specificChoices
- manually-curated options for the user to choose from for this choice
-
setSpecificItemChoice
If thetargetType
isDefaultItemChoiceTargetType.SPECIFIC_PRODUCT
orDefaultItemChoiceTargetType.SPECIFIC_VARIANT
this holds the manually selected option that the customer can choose to add on. This also allows for specific override pricing.- Parameters:
specificChoice
- manually selected option for the user to choose to add on
-
setAttributes
Miscellaneous attributes for this tag.- Parameters:
attributes
- Miscellaneous attributes for this tag.
-
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-