Package org.passay

Class NumberRangeRule

  • All Implemented Interfaces:
    Rule

    public class NumberRangeRule
    extends Object
    implements Rule
    Rule for determining if a password contains any number within a defined range, lower inclusive, upper exclusive.
    Author:
    Middleware Services
    • Field Detail

      • reportAllFailures

        protected boolean reportAllFailures
        Whether to report all sequence matches or just the first.
    • Constructor Detail

      • NumberRangeRule

        public NumberRangeRule​(int lower,
                               int upper)
        Creates a new number range rule.
        Parameters:
        lower - end of the number range, inclusive
        upper - end of the number range, exclusive
      • NumberRangeRule

        public NumberRangeRule​(int lower,
                               int upper,
                               boolean reportAll)
        Creates a new number range rule.
        Parameters:
        lower - end of the number range, inclusive
        upper - end of the number range, exclusive
        reportAll - whether to report all matches or just the first
      • NumberRangeRule

        public NumberRangeRule​(int lower,
                               int upper,
                               MatchBehavior behavior)
        Creates a new number range rule.
        Parameters:
        lower - end of the number range, inclusive
        upper - end of the number range, exclusive
        behavior - how to match number range
      • NumberRangeRule

        public NumberRangeRule​(int lower,
                               int upper,
                               MatchBehavior behavior,
                               boolean reportAll)
        Creates a new number range rule.
        Parameters:
        lower - end of the number range, inclusive
        upper - end of the number range, exclusive
        behavior - how to match number range
        reportAll - whether to report all matches or just the first
    • Method Detail

      • getLowerRange

        public int getLowerRange()
        Returns the lower range for this rule.
        Returns:
        lower range
      • getUpperRange

        public int getUpperRange()
        Returns the upper range for this rule.
        Returns:
        upper range
      • getMatchBehavior

        public MatchBehavior getMatchBehavior()
        Returns the match behavior for this rule.
        Returns:
        match behavior
      • validate

        public RuleResult validate​(PasswordData passwordData)
        Description copied from interface: Rule
        Validates the supplied password data per the requirements of this rule.
        Specified by:
        validate in interface Rule
        Parameters:
        passwordData - to verify (not null).
        Returns:
        details on password verification
      • createRuleResultDetailParameters

        protected Map<String,​Object> createRuleResultDetailParameters​(int number)
        Creates the parameter data for the rule result detail.
        Parameters:
        number - matching number
        Returns:
        map of parameter name to value