public class PasswordGenerator extends Object
Constructor and Description |
---|
PasswordGenerator()
Default constructor.
|
PasswordGenerator(Random r)
Creates a new password generator with the supplied random.
|
Modifier and Type | Method and Description |
---|---|
protected void |
fillRandomCharacters(CharSequence source,
int count,
Appendable target)
Fills the supplied target with count random characters from source.
|
String |
generatePassword(int length,
CharacterRule... rules)
Deprecated.
|
String |
generatePassword(int length,
List<? extends Rule> rules)
Generates a password of the supplied length which meets the requirements of the supplied character rules.
|
<T extends Rule> |
generatePassword(int length,
T... rules)
|
int |
getRetryCount()
Tracks the number retries.
|
protected void |
randomize(CharBuffer buffer)
Randomizes the contents of the given buffer.
|
public PasswordGenerator()
public PasswordGenerator(Random r)
r
- randompublic int getRetryCount()
@Deprecated public String generatePassword(int length, CharacterRule... rules)
generatePassword(int, Rule[])
length
- of password to generaterules
- to generate compliant password frompublic <T extends Rule> String generatePassword(int length, T... rules)
T
- type of rulelength
- of password to generaterules
- to generate compliant password frompublic String generatePassword(int length, List<? extends Rule> rules)
length
- of password to generaterules
- to generate compliant password fromprotected void fillRandomCharacters(CharSequence source, int count, Appendable target)
source
- of random characters.count
- number of random characters.target
- character sequence that will hold characters.protected void randomize(CharBuffer buffer)
buffer
- character buffer whose contents will be randomized.Copyright © 2003-2024 Virginia Tech. All Rights Reserved.