|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.fasterxml.uuid.UUIDGenerator
com.fasterxml.uuid.NoArgGenerator
com.fasterxml.uuid.impl.RandomBasedGenerator
public class RandomBasedGenerator
Implementation of UUID generator that uses generation method 4.
Note on random number generation when using SecureRandom
for random number
generation: the first time SecureRandom
object is used, there is noticeable delay between
calling the method and getting the reply. This is because SecureRandom
has to initialize itself to reasonably random state. Thus, if you
want to lessen delay, it may be be a good idea to either get the
first random UUID asynchronously from a separate thread, or to
use the other generateRandomBasedUUID passing a previously initialized
SecureRandom instance.
Field Summary | |
---|---|
protected Random |
_random
Random number generator that this generator uses. |
protected boolean |
_secureRandom
Looks like SecureRandom implementation is more efficient
using single call access (compared to basic Random ),
so let's use that knowledge to our benefit. |
protected static Random |
_sharedRandom
Default shared random number generator, used if no random number generator is explicitly specified for instance |
Constructor Summary | |
---|---|
RandomBasedGenerator(Random rnd)
|
Method Summary | |
---|---|
UUID |
generate()
|
UUIDType |
getType()
Accessor for determining type of UUIDs (variant) that this generator instance will produce. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static Random _sharedRandom
protected final Random _random
protected final boolean _secureRandom
SecureRandom
implementation is more efficient
using single call access (compared to basic Random
),
so let's use that knowledge to our benefit.
Constructor Detail |
---|
public RandomBasedGenerator(Random rnd)
rnd
- Random number generator to use for generating UUIDs; if null,
shared default generator is used. Note that it is strongly recommend to
use a good (pseudo) random number generator; for example, JDK's
SecureRandom
.Method Detail |
---|
public UUIDType getType()
UUIDGenerator
getType
in class UUIDGenerator
public UUID generate()
generate
in class NoArgGenerator
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |