Class UUIDStringGenerator

  • All Implemented Interfaces:
    ValueGenerator<java.lang.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 Detail

      • UUIDStringGenerator

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

      • getStorageClass

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

        protected java.lang.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