|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.boylesoftware.cb2.util.UniqueIdGenerator
Generates sequence of unique ids, which can be used, for example, as session ids.
This implementation is thread-safe.
Field Summary | |
protected java.security.MessageDigest |
digest
Digest used to postprocess new ids. |
protected int |
nBytes
Number of bytes in the generated ids. |
protected java.util.Random |
random
Random number generator. |
Constructor Summary | |
UniqueIdGenerator()
Constructs and initializes a new generator for 16 bytes in the generated ids. |
|
UniqueIdGenerator(int nBytes)
Constructs and initializes a new generator. |
Method Summary | |
java.lang.String |
next()
Generates next id. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected final int nBytes
protected final java.util.Random random
protected final java.security.MessageDigest digest
Constructor Detail |
public UniqueIdGenerator(int nBytes)
nBytes
- number of bytes in the ids.public UniqueIdGenerator()
Method Detail |
public java.lang.String next()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |