Class ItemCriteriaRule
java.lang.Object
com.broadleafcommerce.promotion.offer.domain.ItemCriteriaRule
- All Implemented Interfaces:
Serializable
Encapsulates a single rule the forms a part of an
ItemCriteria
. The parent criteria holds
the connective operator
used to join multiple of
these ItemCriteriaRules
together. However, the rule itself may contain
sub-rules with distinct connectives:
name == 'some name' and price > 10.99 or shipping == 'STANDARD'
. Moreover,
numberOfMatchesRequired
allows the user to set an additional restriction on how many
items must match this 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).- Author:
- Nathan Moore (nathanmoore).
- See Also:
-
Constructor Summary
ConstructorDescriptionItemCriteriaRule
(int numberOfMatchesRequired, String rule) ItemCriteriaRule
(String rule) -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
boolean
int
getRule()
String expression used to determine which items must be present so that an order may receive this offer's discount.int
hashCode()
void
setNumberOfMatchesRequired
(int numberOfMatchesRequired) Determines the number of items that must match therule
in order for this criteria to be met.void
String expression used to determine which items must be present so that an order may receive this offer's discount.toString()
-
Constructor Details
-
ItemCriteriaRule
-
ItemCriteriaRule
public ItemCriteriaRule() -
ItemCriteriaRule
-
-
Method Details
-
getNumberOfMatchesRequired
public int getNumberOfMatchesRequired() -
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 therule
in order for this criteria to be met.- Parameters:
numberOfMatchesRequired
- Determines the number of items that must match therule
in order for this criteria to be met.
-
setRule
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.
-
toString
-
equals
-
canEqual
-
hashCode
public int hashCode()
-