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 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 Details

    • ItemCriteriaRule

      public ItemCriteriaRule(String rule)
    • ItemCriteriaRule

      public ItemCriteriaRule()
    • ItemCriteriaRule

      public ItemCriteriaRule(int numberOfMatchesRequired, String rule)
  • Method Details

    • 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 a SpelExpression, 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 the rule in order for this criteria to be met.
      Parameters:
      numberOfMatchesRequired - Determines the number of items that must match the rule in 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 a SpelExpression, 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

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object