Package org.passay.rule
Class WhitespaceRule
java.lang.Object
org.passay.rule.WhitespaceRule
- All Implemented Interfaces:
Rule
Rule for determining if a password contains whitespace characters. Whitespace is defined as tab (0x09), line feed
(0x0A), vertical tab (0x0B), form feed (0x0C), carriage return (0x0D), and space (0x20).
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final UnicodeStringCharacters: TAB,LF,VT,FF,CR,Space.static final StringError code for whitespace rule violation.private final MatchBehaviorWhere to match whitespace.protected final booleanWhether to report all whitespace matches or just the first.private final int[]Stores the whitespace characters that are allowed. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new whitespace rule.WhitespaceRule(MatchBehavior behavior) Creates a new whitespace rule.WhitespaceRule(MatchBehavior behavior, boolean reportAll) Creates a new whitespace rule.WhitespaceRule(UnicodeString unicodeString) Creates a new whitespace rule.WhitespaceRule(UnicodeString unicodeString, boolean reportAll) Creates a new whitespace rule.WhitespaceRule(UnicodeString unicodeString, MatchBehavior behavior) Creates a new whitespace rule.WhitespaceRule(UnicodeString unicodeString, MatchBehavior behavior, boolean reportAll) Creates a new whitespace rule. -
Method Summary
Modifier and TypeMethodDescriptioncreateRuleResultDetailParameters(int cp) Creates the parameter data for the rule result detail.protected RuleResultMetadatacreateRuleResultMetadata(PasswordData password) Creates the rule result metadata.Returns the match behavior for this rule.booleanReturns whether to report all matches or just the first.Returns the whitespace characters 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:
-
CHARS
Characters: TAB,LF,VT,FF,CR,Space. -
reportAllFailures
protected final boolean reportAllFailuresWhether to report all whitespace matches or just the first. -
whitespaceCharacters
private final int[] whitespaceCharactersStores the whitespace characters that are allowed. -
matchBehavior
Where to match whitespace.
-
-
Constructor Details
-
WhitespaceRule
public WhitespaceRule()Creates a new whitespace rule. -
WhitespaceRule
Creates a new whitespace rule.- Parameters:
behavior- how to match whitespace
-
WhitespaceRule
Creates a new whitespace rule.- Parameters:
unicodeString- character code points that are whitespace
-
WhitespaceRule
Creates a new whitespace rule.- Parameters:
behavior- how to match whitespacereportAll- whether to report all matches or just the first
-
WhitespaceRule
Creates a new whitespace rule.- Parameters:
unicodeString- whitespace character code pointsbehavior- how to match whitespace
-
WhitespaceRule
Creates a new whitespace rule.- Parameters:
unicodeString- whitespace character code pointsreportAll- whether to report all matches or just the first
-
WhitespaceRule
Creates a new whitespace rule.- Parameters:
unicodeString- whitespace charactersbehavior- how to match whitespacereportAll- 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
-
getWhitespaceCharacters
Returns the whitespace characters for this rule.- Returns:
- whitespace characters
-
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:
cp- whitespace character code point- Returns:
- map of parameter name to value
-
createRuleResultMetadata
Creates the rule result metadata.- Parameters:
password- data used for metadata creation- Returns:
- rule result metadata
-
toString
-