public class GUID extends StringID
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.| Modifier and Type | Class and Description |
|---|---|
static class |
GUID.GUIDNamespace |
StringID.StringIDNamespace| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_BYTE_LENGTH |
protected static java.security.SecureRandom |
random |
static java.lang.String |
SR_DEFAULT_ALGO |
static java.lang.String |
SR_DEFAULT_PROVIDER |
| Modifier | Constructor and Description |
|---|---|
protected |
GUID(Namespace n) |
protected |
GUID(Namespace n,
int byteLength) |
protected |
GUID(Namespace n,
java.lang.String value) |
protected |
GUID(Namespace n,
java.lang.String algo,
java.lang.String provider,
int byteLength)
Protected constructor for factory-based construction
|
| Modifier and Type | Method and Description |
|---|---|
protected static java.security.SecureRandom |
getRandom(java.lang.String algo,
java.lang.String provider)
Get SecureRandom instance for creation of random number.
|
protected static void |
initializeRandom(java.lang.String algo,
java.lang.String provider) |
java.lang.String |
toString() |
compareTo, equals, getName, getNamespace, hashCode, namespaceCompareTo, namespaceEquals, namespaceGetName, namespaceHashCode, setEmptyNamespace, toExternalFormgetAdapter, namespaceToExternalFormpublic static final java.lang.String SR_DEFAULT_ALGO
public static final java.lang.String SR_DEFAULT_PROVIDER
public static final int DEFAULT_BYTE_LENGTH
protected static transient java.security.SecureRandom random
protected GUID(Namespace n, java.lang.String algo, java.lang.String provider, int byteLength) throws IDCreateException
n - the Namespace this identity will belong toprovider - the name of the algorithm to use. See SecureRandombyteLength - the length of the target number (in bytes)IDCreateExceptionprotected GUID(Namespace n, java.lang.String value)
protected GUID(Namespace n, int byteLength) throws IDCreateException
IDCreateExceptionprotected GUID(Namespace n) throws IDCreateException
IDCreateExceptionprotected static java.security.SecureRandom getRandom(java.lang.String algo,
java.lang.String provider)
throws java.lang.Exception
algo - the String algorithm specification (e.g. "SHA1PRNG") for
creation of the SecureRandom instanceprovider - the provider of the implementation of the given algorighm
(e.g. "SUN")java.lang.Exception - thrown if SecureRandom instance cannot be created/accessedprotected static void initializeRandom(java.lang.String algo,
java.lang.String provider)
throws java.lang.Exception
java.lang.Exception