Class ItemCriteria
- java.lang.Object
-
- com.broadleafcommerce.promotion.offer.domain.ItemCriteria
-
- All Implemented Interfaces:
Serializable
public class ItemCriteria extends Object implements Serializable
Encapsulates all criteria used either to determine if an item is a qualifier or a target.- An "item qualifier" is an item that qualifies its order or other items to receive an offer's discount.
- A "target item" is an item that can receive an offer's discount.
Each criteria is made up of 1 or more
Rules. A rule is represented as an string expression, using Spring Expression Language by default:itemName.contains('some name') and itemPrice > 10.99. It also provides additional granularity to a criteria by allowing a restriction on how many matches are required for the rule: Apply this offer when there are 2 items whereitemName.contains('some name') and itemPrice > 10.99in the order. If there were 4 such items, then this offer could be applied twice to the order (once per set of complete matches).The criteria also provides control over its rules are connected logically: Thus, you can make a criteria equivalent to "Apply this offer when there are, rule 1, 2 hats with prices greater than $10 and, rule 2, 1 tie or belt with price greater than $10."
- Author:
- Nathan Moore (nathanmoore).
- See Also:
Offer,ItemCriteriaRule, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ItemCriteria()ItemCriteria(String connectiveOperator, Set<ItemCriteriaRule> rules)ItemCriteria(Set<ItemCriteriaRule> rules)Convenience constructor to initialize rules.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancanEqual(Object other)booleanequals(Object o)StringgetConnectiveOperator()The connective with which to join all of therulestogether.Set<ItemCriteriaRule>getRules()Rules that comprise this criteria.inthashCode()voidsetConnectiveOperator(String connectiveOperator)The connective with which to join all of therulestogether.voidsetRules(Set<ItemCriteriaRule> rules)Rules that comprise this criteria.StringtoString()
-
-
-
Constructor Detail
-
ItemCriteria
public ItemCriteria(Set<ItemCriteriaRule> rules)
Convenience constructor to initialize rules.- Parameters:
rules-
-
ItemCriteria
public ItemCriteria()
-
ItemCriteria
public ItemCriteria(String connectiveOperator, Set<ItemCriteriaRule> rules)
-
-
Method Detail
-
getConnectiveOperator
public String getConnectiveOperator()
The connective with which to join all of therulestogether. Individual rules can also have separate sub-rules connected with unrelated operators.- Returns:
- The connective with which to join all of the
rulestogether. - See Also:
DefaultConnectiveOperatorType
-
getRules
public Set<ItemCriteriaRule> getRules()
Rules that comprise this criteria. When multiple rules are present, they will be connected withconnectiveOperator.- Returns:
- The rules that comprise this criteria.
-
setConnectiveOperator
public void setConnectiveOperator(String connectiveOperator)
The connective with which to join all of therulestogether. Individual rules can also have separate sub-rules connected with unrelated operators.- Parameters:
connectiveOperator- The connective with which to join all of therulestogether.- See Also:
DefaultConnectiveOperatorType
-
setRules
public void setRules(Set<ItemCriteriaRule> rules)
Rules that comprise this criteria. When multiple rules are present, they will be connected withconnectiveOperator.- Parameters:
rules- Rules that comprise this criteria.
-
canEqual
protected boolean canEqual(Object other)
-
-