Class UUIDStringGenerator

All Implemented Interfaces:
ValueGenerator<String>

public class UUIDStringGenerator extends AbstractUUIDGenerator
Value generator for a UUID String format. Results in Strings of length 16 characters, containing the IP address of the local machine as per the JDO spec section 18.6.1.
  • Constructor Details

    • UUIDStringGenerator

      public UUIDStringGenerator(StoreManager storeMgr, String name)
      Constructor.
      Parameters:
      storeMgr - StoreManager
      name - Symbolic name for this generator
  • Method Details

    • getStorageClass

      public static Class getStorageClass()
      Accessor for the storage class for values generated with this generator.
      Returns:
      Storage class (in this case String.class)
    • getIdentifier

      protected String getIdentifier()
      Create an identifier with the form "IIIIJJJJHHLLLLCC". Where IIII is the IP address, JJJJ is something unique across JVMs, HH is the High Time, LLLL is the low time, and CC is a count.
      Specified by:
      getIdentifier in class AbstractUUIDGenerator
      Returns:
      The identifier
    • getBytesFromInt

      private static byte[] getBytesFromInt(int val)
      Utility to convert an int into a byte array
      Parameters:
      val - The int
      Returns:
      The bytes
    • getBytesFromShort

      private static byte[] getBytesFromShort(short val)
      Utility to convert a short into a a byte array
      Parameters:
      val - The short
      Returns:
      The bytes