Class AbstractUUIDGenerator

java.lang.Object
org.datanucleus.store.valuegenerator.AbstractGenerator<String>
org.datanucleus.store.valuegenerator.AbstractUUIDGenerator
All Implemented Interfaces:
ValueGenerator<String>
Direct Known Subclasses:
UUIDHexGenerator, UUIDStringGenerator

public abstract class AbstractUUIDGenerator extends AbstractGenerator<String>
Value generator for a UUID format. To be extended by implementations giving the UUID in particular forms.
  • Field Details

    • IP_ADDRESS

      static final int IP_ADDRESS
      IP Address of local machine.
    • JVM_UNIQUE

      static final int JVM_UNIQUE
      Unique value across JVMs on this machine.
    • counter

      static short counter
  • Constructor Details

    • AbstractUUIDGenerator

      public AbstractUUIDGenerator(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)
    • reserveBlock

      protected ValueGenerationBlock<String> reserveBlock(long size)
      Method to reserve "size" values to the block.
      Specified by:
      reserveBlock in class AbstractGenerator<String>
      Parameters:
      size - The block size
      Returns:
      The reserved block
    • getIdentifier

      protected abstract String getIdentifier()
      Create an identifier in the required UUID format required.
      Returns:
      The identifier
    • getCount

      protected short getCount()
      Simple counter for identities.
      Returns:
      The next count value
    • getIntFromByteArray

      private static int getIntFromByteArray(byte[] bytes)
      Utility to convert a byte array to an int.
      Parameters:
      bytes - The byte array
      Returns:
      The int