com.ibm.passwordrules.standard
Class StandardGenerator

java.lang.Object
  |
  +--com.ibm.passwordrules.standard.StandardGenerator
All Implemented Interfaces:
PasswordGenerator

public class StandardGenerator
extends java.lang.Object
implements PasswordGenerator

Default generator used to generate passwords using a random number algorithm.


Field Summary
static int DEFAULT_LENGTH
          Default number of character templates translating to default length of the generated password.
 
Fields inherited from interface com.ibm.passwordrules.PasswordGenerator
LAST_CHARACTER_INDEX
 
Constructor Summary
StandardGenerator()
          Default constructor
 
Method Summary
 void addChars(char[] list)
          Method called by classes implementing Rule interface used to constrain he set of character templates to be used by the generator.
 void allLowerCase()
          Method called by classes implementing Rule interface used to constrain the set of character templates to be used by the generator to contain only lower case characters.
 void allUpperCase()
          Method called by classes implementing Rule interface used to constrain the set of character templates to be used by the generator to contain only upper case characters.
 java.lang.String generate()
          Method will generate a password
 void initialize(java.lang.String parameter)
          Method will prepare the generator instance to use custom character ranges if provided in the given parameter.
 void removeChars(char[] charList)
          Method called by classes implementing Rule interface used to constrain he set of character templates to be used by the generator.
 void setCharListAt(char[] charList, int startIndex, int endIndex)
          Method called by classes implementing Rule interface used to constrain the set of characters to be used by the generator.
 void setLength(int length)
          Method called by classes implementing Rule interface used to constrain he set of character templates to be used by the generator.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_LENGTH

public static final int DEFAULT_LENGTH
Default number of character templates translating to default length of the generated password.
Constructor Detail

StandardGenerator

public StandardGenerator()
Default constructor
Method Detail

generate

public java.lang.String generate()
Method will generate a password
Specified by:
generate in interface PasswordGenerator
Returns:
generated password.

setLength

public void setLength(int length)
Method called by classes implementing Rule interface used to constrain he set of character templates to be used by the generator. Method is part of PasswordGenerator
Specified by:
setLength in interface PasswordGenerator
Parameters:
numChars - Number of character templates to increase by

addChars

public void addChars(char[] list)
Method called by classes implementing Rule interface used to constrain he set of character templates to be used by the generator. Method is part of PasswordGenerator
Specified by:
addChars in interface PasswordGenerator
Parameters:
list - of characters to add to all the character templates.

removeChars

public void removeChars(char[] charList)
Method called by classes implementing Rule interface used to constrain he set of character templates to be used by the generator. Method is part of PasswordGenerator
Specified by:
removeChars in interface PasswordGenerator
Parameters:
charList - list of characters to remove from all the character templates.

allUpperCase

public void allUpperCase()
Method called by classes implementing Rule interface used to constrain the set of character templates to be used by the generator to contain only upper case characters. Method is part of PasswordGenerator
Specified by:
allUpperCase in interface PasswordGenerator

allLowerCase

public void allLowerCase()
Method called by classes implementing Rule interface used to constrain the set of character templates to be used by the generator to contain only lower case characters. Method is part of PasswordGenerator
Specified by:
allLowerCase in interface PasswordGenerator

setCharListAt

public void setCharListAt(char[] charList,
                          int startIndex,
                          int endIndex)
Method called by classes implementing Rule interface used to constrain the set of characters to be used by the generator. Method is part of PasswordGenerator
Specified by:
setCharListAt in interface PasswordGenerator
Parameters:
charList - list of characters to set
index - of the first character to set

initialize

public void initialize(java.lang.String parameter)
Method will prepare the generator instance to use custom character ranges if provided in the given parameter. Method will be called once immediately after the generator instance is created.
Specified by:
initialize in interface PasswordGenerator
Parameters:
parameter - - may contain unicode ranges of characters to be used in the generator