Arch4J 1.1

org.arch4j.persistence.domainmapper
Class JugRandomBasedUuidGenerator

java.lang.Object
  |
  +--org.arch4j.persistence.domainmapper.JugRandomBasedUuidGenerator
All Implemented Interfaces:
IdentifierGenerator

public class JugRandomBasedUuidGenerator
extends Object
implements IdentifierGenerator

This class implements the IdentifierGenerator interface to provide a random-based UUID generator. The actual implementation is delegated to a third-party library, the open-source Java UUID Generator (JUG). The returned UUID string is 36 characters long; for example, c383402e-98a8-4535-8b80-3a0216d78f80

Subclasses are free to extend this class and override the method getSecureRandomNumberGenerator(), which provides a SecureRandom number generator for the JUG implementation.

Version:
$Revision: 1.2 $
Author:
$Author: rgreinke $

Constructor Summary
JugRandomBasedUuidGenerator()
           
 
Method Summary
 Serializable generate()
          Generate a new unique identifier.
protected  SecureRandom getSecureRandomNumberGenerator()
          Returns a SecureRandom number generator that is used to seed the JUG implementation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JugRandomBasedUuidGenerator

public JugRandomBasedUuidGenerator()
Method Detail

generate

public Serializable generate()
Generate a new unique identifier.

Specified by:
generate in interface IdentifierGenerator
Returns:
A Serializable unique identifier.

getSecureRandomNumberGenerator

protected SecureRandom getSecureRandomNumberGenerator()
Returns a SecureRandom number generator that is used to seed the JUG implementation. This method can be overridden in subclasses to provide their own number generator. Defaults to the number generator JUG uses.

Returns:
A SecureRandom, cryptographically strong pseudo-random number generator (PRNG).

Arch4J 1.1

Copyright © 2000-2004 SpiderLogic, a service of Wipfli Ullrich Bertelson LLP.