org.openbp.common.util
Class UUIDGenerator

java.lang.Object
  extended by org.openbp.common.util.UUIDGenerator

public final class UUIDGenerator
extends java.lang.Object

UUID generator. Generates a universally unique id based on the ip address of the computer and the current time. This class is a singleton.

Author:
Heiko Erhardt

Method Summary
static void appendHexValue(java.lang.StringBuffer sb, long value, int digits)
          Appends a hexadecimal value to the given string buffer.
 java.lang.String createUUID()
          Creates a new UUID.
static UUIDGenerator getInstance()
          Gets the singleton instance of this class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static UUIDGenerator getInstance()
Gets the singleton instance of this class.


createUUID

public java.lang.String createUUID()
Creates a new UUID.

Returns:
The UUID (20 hex digits) or null on error (shouldn't happen)

appendHexValue

public static void appendHexValue(java.lang.StringBuffer sb,
                                  long value,
                                  int digits)
Appends a hexadecimal value to the given string buffer.

Parameters:
sb - String buffer to append to
value - The value to append
digits - Minimum number of digits
The method will insert leading '0' fill characters.


Copyright © 2011. All Rights Reserved.