Package org.passay.rule
Class NumberRangeRule
java.lang.Object
org.passay.rule.NumberRangeRule
- All Implemented Interfaces:
Rule
Rule for determining if a password contains any number within a defined range, lower inclusive, upper exclusive.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringError code for whitespace rule violation.private final intLower end of the range.private final MatchBehaviorWhere to match each number.protected final booleanWhether to report all sequence matches or just the first.private final intUpper end of the range. -
Constructor Summary
ConstructorsConstructorDescriptionNumberRangeRule(int lower, int upper) Creates a new number range rule.NumberRangeRule(int lower, int upper, boolean reportAll) Creates a new number range rule.NumberRangeRule(int lower, int upper, MatchBehavior behavior) Creates a new number range rule.NumberRangeRule(int lower, int upper, MatchBehavior behavior, boolean reportAll) Creates a new number range rule. -
Method Summary
Modifier and TypeMethodDescriptioncreateRuleResultDetailParameters(int number) Creates the parameter data for the rule result detail.intReturns the lower range for this rule.Returns the match behavior for this rule.booleanReturns whether to report all matches or just the first.intReturns the upper range for this rule.toString()validate(PasswordData passwordData) Validates the supplied password data per the requirements of this rule.
-
Field Details
-
ERROR_CODE
Error code for whitespace rule violation.- See Also:
-
reportAllFailures
protected final boolean reportAllFailuresWhether to report all sequence matches or just the first. -
lowerRange
private final int lowerRangeLower end of the range. -
upperRange
private final int upperRangeUpper end of the range. -
matchBehavior
Where to match each number.
-
-
Constructor Details
-
NumberRangeRule
public NumberRangeRule(int lower, int upper) Creates a new number range rule.- Parameters:
lower- end of the number range, inclusiveupper- 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, inclusiveupper- end of the number range, exclusivereportAll- whether to report all matches or just the first
-
NumberRangeRule
Creates a new number range rule.- Parameters:
lower- end of the number range, inclusiveupper- end of the number range, exclusivebehavior- how to match number range
-
NumberRangeRule
Creates a new number range rule.- Parameters:
lower- end of the number range, inclusiveupper- end of the number range, exclusivebehavior- how to match number rangereportAll- whether to report all matches or just the first
-
-
Method Details
-
getReportAllFailures
public boolean getReportAllFailures()Returns whether to report all matches or just the first.- Returns:
- whether to report all matches or just the first
-
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
Returns the match behavior for this rule.- Returns:
- match behavior
-
validate
Description copied from interface:RuleValidates the supplied password data per the requirements of this rule. -
createRuleResultDetailParameters
Creates the parameter data for the rule result detail.- Parameters:
number- matching number- Returns:
- map of parameter name to value
-
toString
-