Class ItemCriteria
- All Implemented Interfaces:
Serializable
- 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 where
itemName.contains('some name') and itemPrice > 10.99 in 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:
-
Constructor Summary
ConstructorsConstructorDescriptionItemCriteria(String connectiveOperator, Set<ItemCriteriaRule> rules) ItemCriteria(Set<ItemCriteriaRule> rules) Convenience constructor to initialize rules. -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanbooleanThe connective with which to join all of therulestogether.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.toString()
-
Constructor Details
-
ItemCriteria
Convenience constructor to initialize rules.- Parameters:
rules-
-
ItemCriteria
public ItemCriteria() -
ItemCriteria
-
-
Method Details
-
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
Rules that comprise this criteria. When multiple rules are present, they will be connected withconnectiveOperator.- Returns:
- The rules that comprise this criteria.
-
setConnectiveOperator
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
Rules that comprise this criteria. When multiple rules are present, they will be connected withconnectiveOperator.- Parameters:
rules- Rules that comprise this criteria.
-
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-