Package com.fasterxml.uuid.impl
Class NameBasedGenerator
java.lang.Object
com.fasterxml.uuid.UUIDGenerator
com.fasterxml.uuid.StringArgGenerator
com.fasterxml.uuid.impl.NameBasedGenerator
Implementation of UUID generator that uses one of name-based generation methods
(versions 3 (MD5) and 5 (SHA1)).
As all JUG provided implementations, this generator is fully thread-safe; access to digester is synchronized as necessary.
- Since:
- 3.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final MessageDigestMessage digesster to use for hash calculationprotected final UUIDNamespace to use as prefix.protected final UUIDTypestatic final Charsetstatic final UUIDNamespace used when name is a DNS name.static final UUIDNamespace used when name is an OID.static final UUIDNamespace used when name is a URL.static final UUIDNamespace used when name is an X500 identifier -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongenerate(byte[] nameBytes) Method for generating name-based UUIDs using specified byte-serialization of name.Method for generating name-based UUIDs using specified name (serialized to bytes using UTF-8 encoding)getType()Accessor for determining type of UUIDs (version) that this generator instance will produce.Methods inherited from class com.fasterxml.uuid.UUIDGenerator
_toInt, _toLong, _toShort
-
Field Details
-
_utf8
-
NAMESPACE_DNS
Namespace used when name is a DNS name. -
NAMESPACE_URL
Namespace used when name is a URL. -
NAMESPACE_OID
Namespace used when name is an OID. -
NAMESPACE_X500
Namespace used when name is an X500 identifier -
_namespace
Namespace to use as prefix. -
_digester
Message digesster to use for hash calculation -
_type
-
-
Constructor Details
-
NameBasedGenerator
- Parameters:
namespace- 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.digester- Hashing algorithm to use.
-
-
Method Details
-
getType
Description copied from class:UUIDGeneratorAccessor for determining type of UUIDs (version) that this generator instance will produce.- Specified by:
getTypein classUUIDGenerator
-
getNamespace
-
generate
Description copied from class:StringArgGeneratorMethod for generating name-based UUIDs using specified name (serialized to bytes using UTF-8 encoding)- Specified by:
generatein classStringArgGenerator
-
generate
Description copied from class:StringArgGeneratorMethod for generating name-based UUIDs using specified byte-serialization of name.- Specified by:
generatein classStringArgGenerator
-