Class GUID

All Implemented Interfaces:
Serializable, Comparable, Principal, org.eclipse.core.runtime.IAdaptable, ID

public class GUID extends StringID
Globally unique ID implementation class. Uses SecureRandom to create a unique number of given byte length. Default byte length for secure number is 20 bytes. Default algorithm used for creating a SecureRandom instance is SHA1PRNG.
See Also:
  • Field Details

    • SR_DEFAULT_ALGO

      public static final String SR_DEFAULT_ALGO
    • SR_DEFAULT_PROVIDER

      public static final String SR_DEFAULT_PROVIDER
    • DEFAULT_BYTE_LENGTH

      public static final int DEFAULT_BYTE_LENGTH
      See Also:
    • random

      protected static transient SecureRandom random
  • Constructor Details

  • Method Details

    • getRandom

      protected static SecureRandom getRandom(String algo, String provider) throws Exception
      Get SecureRandom instance for creation of random number.
      Parameters:
      algo - the String algorithm specification (e.g. "SHA1PRNG") for creation of the SecureRandom instance
      provider - the provider of the implementation of the given algorighm (e.g. "SUN")
      Returns:
      SecureRandom
      Throws:
      Exception - thrown if SecureRandom instance cannot be created/accessed
    • initializeRandom

      protected static void initializeRandom(String algo, String provider) throws Exception
      Throws:
      Exception
    • toString

      public String toString()
      Specified by:
      toString in interface Principal
      Overrides:
      toString in class StringID