|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.fasterxml.uuid.UUIDGenerator
com.fasterxml.uuid.StringArgGenerator
com.fasterxml.uuid.impl.NameBasedGenerator
public class NameBasedGenerator
Implementation of UUID generator that uses one of name-based generation methods (variants 3 (MD5) and 5 (SHA1)).
As all JUG provided implementations, this generator is fully thread-safe; access to digester is synchronized as necessary.
Field Summary | |
---|---|
protected MessageDigest |
_digester
Message digesster to use for hash calculation |
protected UUID |
_namespace
Namespace to use as prefix. |
protected UUIDType |
_type
|
static Charset |
_utf8
|
static UUID |
NAMESPACE_DNS
Namespace used when name is a DNS name. |
static UUID |
NAMESPACE_OID
Namespace used when name is an OID. |
static UUID |
NAMESPACE_URL
Namespace used when name is a URL. |
static UUID |
NAMESPACE_X500
Namespace used when name is an X500 identifier |
Constructor Summary | |
---|---|
NameBasedGenerator(UUID namespace,
MessageDigest digester,
UUIDType type)
|
Method Summary | |
---|---|
UUID |
generate(byte[] nameBytes)
Method for generating name-based UUIDs using specified byte-serialization of name. |
UUID |
generate(String name)
Method for generating name-based UUIDs using specified name (serialized to bytes using UTF-8 encoding) |
UUID |
getNamespace()
|
UUIDType |
getType()
Accessor for determining type of UUIDs (variant) that this generator instance will produce. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Charset _utf8
public static final UUID NAMESPACE_DNS
public static final UUID NAMESPACE_URL
public static final UUID NAMESPACE_OID
public static final UUID NAMESPACE_X500
protected final UUID _namespace
protected final MessageDigest _digester
protected final UUIDType _type
Constructor Detail |
---|
public NameBasedGenerator(UUID namespace, MessageDigest digester, UUIDType type)
nameSpaceUUID
- of the namespace, as defined by the
spec. UUID has 4 pre-defined "standard" name space strings
that can be passed to UUID constructor (see example below).
Note that this argument is optional; if no namespace is needed
(for example when name includes namespace prefix), null may be passed.hasher
- Hashing algorithm to use.Method Detail |
---|
public UUIDType getType()
UUIDGenerator
getType
in class UUIDGenerator
public UUID getNamespace()
public UUID generate(String name)
StringArgGenerator
generate
in class StringArgGenerator
public UUID generate(byte[] nameBytes)
StringArgGenerator
generate
in class StringArgGenerator
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |