org.jlog2.util
Class UuidHandler

java.lang.Object
  extended by org.jlog2.util.UuidHandler

public class UuidHandler
extends java.lang.Object

This class creates unique uuids, or uuids that are difficult to duplicate. This is similar to the Java UUID creator.


Constructor Summary
UuidHandler()
           
 
Method Summary
static java.lang.String getUuid(int uuidLength)
          Create a new uuid that is a subset or concatenation of the Java UUID generator.
static java.lang.String getUuid(int uuidLength, long seed)
          Create a new uuid that is randomly generated round the entered seed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UuidHandler

public UuidHandler()
Method Detail

getUuid

public static java.lang.String getUuid(int uuidLength)
                                throws java.lang.Exception
Create a new uuid that is a subset or concatenation of the Java UUID generator. This is possibly more robust as there is a random delay added to the string creation.

Parameters:
uuidLength - the number of characters in the seedUuid.
Returns:
the value of the newly created uuid.
Throws:
java.lang.Exception - any error.

getUuid

public static java.lang.String getUuid(int uuidLength,
                                       long seed)
                                throws java.lang.Exception
Create a new uuid that is randomly generated round the entered seed.

Parameters:
uuidLength - the number of characters in the uuid.
seed - the value to seed the uuid creator with.
Returns:
the value of the newly created uuid.
Throws:
java.lang.Exception - any error.