com.ibm.passwordrules.standard
Class StartsWithChar

java.lang.Object
  |
  +--com.ibm.passwordrules.LexicalRule
        |
        +--com.ibm.passwordrules.standard.StartsWithChar
All Implemented Interfaces:
java.lang.Cloneable, Rule, java.io.Serializable

public class StartsWithChar
extends LexicalRule

This class implements built-in rule for restricting passwords to start with a given sequence of characters.

See Also:
Serialized Form

Field Summary
static java.lang.String INCOMPATIBLE_STARTS_WITH_RESTRICTIONS
           
static java.lang.String REQUIRED_CHARACTERS_NOT_FOUND
           
 
Fields inherited from class com.ibm.passwordrules.LexicalRule
DEFAULT_MAX_SEQUENTIAL_CHARACTERS, LOWER_CASE_ONLY, UPPER_CASE_ONLY
 
Constructor Summary
StartsWithChar(char[] charList)
           
StartsWithChar(java.lang.String charList)
           
 
Method Summary
 void constrain(PasswordGenerator template)
          Constrain the generation template to values we know are valid.
 char[] getCharList()
           
 boolean join(Rule rule)
          Try to join the specified rule with this one.
 void setCharList(char[] charList)
           
 boolean validate(java.lang.String password, ValidationInfo validationInfo)
          Validate the given password using the given validation info.
 
Methods inherited from class com.ibm.passwordrules.LexicalRule
getParameter, setParameter, validateSafe
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INCOMPATIBLE_STARTS_WITH_RESTRICTIONS

public static java.lang.String INCOMPATIBLE_STARTS_WITH_RESTRICTIONS

REQUIRED_CHARACTERS_NOT_FOUND

public static java.lang.String REQUIRED_CHARACTERS_NOT_FOUND
Constructor Detail

StartsWithChar

public StartsWithChar(char[] charList)

StartsWithChar

public StartsWithChar(java.lang.String charList)
Method Detail

constrain

public void constrain(PasswordGenerator template)
Constrain the generation template to values we know are valid.
Overrides:
constrain in class LexicalRule
Parameters:
generator - including a character template to be constrained.

validate

public boolean validate(java.lang.String password,
                        ValidationInfo validationInfo)
                 throws InvalidPasswordException
Validate the given password using the given validation info.
Parameters:
validationInfo - contains contextual information about the password being validated.
password - Password to validate.
Returns:
true if password is valid
Throws:
InvalidPasswordException - thrown when password is invalid.

getCharList

public char[] getCharList()

setCharList

public void setCharList(char[] charList)

join

public boolean join(Rule rule)
             throws IncompatibleRulesException
Try to join the specified rule with this one. The more restrictive rule takes precedence.
Parameters:
rule - The rule to be joined with this one.
Returns:
True if the rule was successfully joined.
Throws:
IncompatibleRulesException - Thrown when given rule cannot be joined because it is not compatible.