java.lang.Object
rodeo.password.pgencheck.PasswordMaker.Factory
- Enclosing class:
- PasswordMaker
Internal factory to create
PasswordMakers.
This factory class allows you to build a PasswordMaker using a fluent interface. You create a
Factory by calling PasswordMaker.factory().
Once all the criteria have been specified, you call the create function
to create a PasswordMaker object.
-
Method Summary
Modifier and TypeMethodDescriptionaddCharGroup(String charGroup) Add a group of allowed characters in the composition of the password.addCharGroup(String charGroup, int minCount) Add a group of allowed characters in the composition of the password and specifies a minimum character count.addCharGroup(String charGroup, int minCount, int maxCount) Add a group of allowed characters in the composition of the password and specifies a minimum and a maximum character count.create()Create aPasswordMakeraccording to the specified criteria.disallowDuplicateCharacters(boolean disallowDuplicateCharacters) Disallow or allow duplicate character groups and between character groups.setLength(int length) Sets the length of generated password.setRandomUIntGenerator(RandomUIntGenerator randomUIntGenerator) Specify the method used to generate random numbers used for password generation.
-
Method Details
-
setLength
Sets the length of generated password.- Parameters:
length- the password length- Returns:
thisfactory
-
setRandomUIntGenerator
Specify the method used to generate random numbers used for password generation.- Parameters:
randomUIntGenerator- an implementation of theRandomUIntGeneratorinterface- Returns:
thisfactory- See Also:
-
create
Create aPasswordMakeraccording to the specified criteria.- Returns:
- a new
PasswordMakermatching the specified criteria - Throws:
IllegalStateException- if no character group has been specifiedIllegalStateException- if password generation would be impossible because the minimum count requirements on character groups would exceed the maximum length allowed for the passwordIllegalStateException- if password generation would be impossible because too many restrictions are placed on the maximum character count of each character group so that the specified password length could not be reached.
-
addCharGroup
Add a group of allowed characters in the composition of the password.- Parameters:
charGroup- aStringcontaining all characters allowed in this group- Returns:
thisfactory- Throws:
IllegalArgumentException- if the character group contains duplicates or if the character group contains characters already present in other character groups, unless duplicates have been explicitly allowed by callingdisallowDuplicateCharacters(false)- See Also:
-
addCharGroup
Add a group of allowed characters in the composition of the password and specifies a minimum character count.- Parameters:
charGroup- aStringcontaining all characters allowed in this groupminCount- minimum number of characters from this group that must be present in the password- Returns:
thisfactory- Throws:
IllegalArgumentException- if the character group contains duplicates or if the character group contains characters already present in other character groups, unless duplicates have been explicitly allowed by callingdisallowDuplicateCharacters(false)IllegalArgumentException- ifminCount < 0- See Also:
-
addCharGroup
Add a group of allowed characters in the composition of the password and specifies a minimum and a maximum character count.- Parameters:
charGroup- aStringcontaining all characters allowed in this groupminCount- minimum number of characters from this group that must be present in the passwordmaxCount- maximum number of characters from this group allowed in the password; a value of0(zero) means "unlimited" (same as callingaddCharGroup(String, int))- Returns:
thisfactory- Throws:
IllegalArgumentException- if the character group contains duplicates or if the character group contains characters already present in other character groups, unless duplicates have been explicitly allowed by callingdisallowDuplicateCharacters(false)IllegalArgumentException- ifminCount < 0, ormaxCount < 0, ormaxCount < minCount(unlessmaxCount == 0)- See Also:
-
disallowDuplicateCharacters
Disallow or allow duplicate character groups and between character groups. Allowing duplicate is usually unnecessary and error-prone.- Parameters:
disallowDuplicateCharacters-trueif duplicates character should be disallowed (default),falseotherwise- Returns:
thisfactory
-