com.fasterxml.uuid.impl
Class NameBasedGenerator

java.lang.Object
  extended by com.fasterxml.uuid.UUIDGenerator
      extended by com.fasterxml.uuid.StringArgGenerator
          extended by com.fasterxml.uuid.impl.NameBasedGenerator

public class NameBasedGenerator
extends StringArgGenerator

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.

Since:
3.0

Field Summary
protected  MessageDigest _digester
          Message digesster to use for hash calculation
protected  UUID _namespace
          Namespace to use as prefix.
protected  UUIDType _type
           
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(String name)
           
 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

NAMESPACE_DNS

public static final UUID NAMESPACE_DNS
Namespace used when name is a DNS name.


NAMESPACE_URL

public static final UUID NAMESPACE_URL
Namespace used when name is a URL.


NAMESPACE_OID

public static final UUID NAMESPACE_OID
Namespace used when name is an OID.


NAMESPACE_X500

public static final UUID NAMESPACE_X500
Namespace used when name is an X500 identifier


_namespace

protected final UUID _namespace
Namespace to use as prefix.


_digester

protected final MessageDigest _digester
Message digesster to use for hash calculation


_type

protected final UUIDType _type
Constructor Detail

NameBasedGenerator

public NameBasedGenerator(UUID namespace,
                          MessageDigest digester,
                          UUIDType type)
Parameters:
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

getType

public UUIDType getType()
Description copied from class: UUIDGenerator
Accessor for determining type of UUIDs (variant) that this generator instance will produce.

Specified by:
getType in class UUIDGenerator

getNamespace

public UUID getNamespace()

generate

public UUID generate(String name)
Specified by:
generate in class StringArgGenerator


Copyright © 2010 FasterXML.com. All Rights Reserved.