Class ItemCriteriaRule
- java.lang.Object
-
- com.broadleafcommerce.promotion.offer.domain.ItemCriteriaRule
-
- All Implemented Interfaces:
Serializable
public class ItemCriteriaRule extends Object implements Serializable
Encapsulates a single rule the forms a part of anItemCriteria. The parent criteria holds theconnective operatorused to join multiple of theseItemCriteriaRulestogether. However, the rule itself may contain sub-rules with distinct connectives:name == 'some name' and price > 10.99 or shipping == 'STANDARD'. Moreover,numberOfMatchesRequiredallows the user to set an additional restriction on how many items must match this 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).- Author:
- Nathan Moore (nathanmoore).
- See Also:
ItemCriteria,Offer, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ItemCriteriaRule()ItemCriteriaRule(int numberOfMatchesRequired, String rule)ItemCriteriaRule(String rule)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancanEqual(Object other)booleanequals(Object o)intgetNumberOfMatchesRequired()StringgetRule()String expression used to determine which items must be present so that an order may receive this offer's discount.inthashCode()voidsetNumberOfMatchesRequired(int numberOfMatchesRequired)Determines the number of items that must match therulein order for this criteria to be met.voidsetRule(String rule)String expression used to determine which items must be present so that an order may receive this offer's discount.StringtoString()
-
-
-
Method Detail
-
getNumberOfMatchesRequired
public int getNumberOfMatchesRequired()
-
getRule
public String getRule()
String expression used to determine which items must be present so that an order may receive this offer's discount. This could be a string representation of aSpelExpression, e.g.,name == 'some-name' || id == '1', or that of some other expression language.- Returns:
- String expression used to determine whether an item is a qualifier or target
-
setNumberOfMatchesRequired
public void setNumberOfMatchesRequired(int numberOfMatchesRequired)
Determines the number of items that must match therulein order for this criteria to be met.- Parameters:
numberOfMatchesRequired- Determines the number of items that must match therulein order for this criteria to be met.
-
setRule
public void setRule(String rule)
String expression used to determine which items must be present so that an order may receive this offer's discount. This could be a string representation of aSpelExpression, e.g.,name == 'some-name' || id == '1', or that of some other expression language.- Parameters:
rule- String expression used to determine whether an item is a qualifier or target.
-
canEqual
protected boolean canEqual(Object other)
-
-