com.fasterxml.uuid
Class Generators

java.lang.Object
  extended by com.fasterxml.uuid.Generators

public class Generators
extends Object

Root factory class for constructing UUID generators.

Since:
3.0
Author:
tatu

Field Summary
protected static UUIDTimer _sharedTimer
          If no explicit timer (and synchronizer it implicitly uses) is specified, we will create and use a single lazily-constructed timer, which uses in-JVM synchronization but no external file-based syncing.
 
Constructor Summary
Generators()
           
 
Method Summary
static NameBasedGenerator nameBasedGenerator()
          Factory method for constructing UUID generator that uses specified random number generator for constructing UUIDs according to standard method number 5, but without using a namespace.
static NameBasedGenerator nameBasedGenerator(UUID namespace)
          Factory method for constructing UUID generator that uses specified random number generator for constructing UUIDs according to standard method number 5, with specified namespace (or without one if null is specified).
static NameBasedGenerator nameBasedGenerator(UUID namespace, MessageDigest digester)
          Factory method for constructing UUID generator that uses specified random number generator for constructing UUIDs according to standard method number 3 or 5, with specified namespace (or without one if null is specified), using specified digester.
static RandomBasedGenerator randomBasedGenerator()
          Factory method for constructing UUID generator that uses default (shared) random number generator for constructing UUIDs according to standard method number 4.
static RandomBasedGenerator randomBasedGenerator(Random rnd)
          Factory method for constructing UUID generator that uses specified random number generator for constructing UUIDs according to standard method number 4.
static TimeBasedGenerator timeBasedGenerator()
          Factory method for constructing UUID generator that generates UUID using variant 1 (time+location based).
static TimeBasedGenerator timeBasedGenerator(EthernetAddress ethernetAddress)
          Factory method for constructing UUID generator that generates UUID using variant 1 (time+location based), using specified Ethernet address as the location part of UUID.
static TimeBasedGenerator timeBasedGenerator(EthernetAddress ethernetAddress, TimestampSynchronizer sync)
          Factory method for constructing UUID generator that generates UUID using variant 1 (time+location based), using specified Ethernet address as the location part of UUID, and specified synchronizer (which may add additional restrictions to guarantee system-wide uniqueness).
static TimeBasedGenerator timeBasedGenerator(EthernetAddress ethernetAddress, UUIDTimer timer)
          Factory method for constructing UUID generator that generates UUID using variant 1 (time+location based), using specified Ethernet address as the location part of UUID, and specified UUIDTimer instance (which includes embedded synchronizer that defines synchronization behavior).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_sharedTimer

protected static UUIDTimer _sharedTimer
If no explicit timer (and synchronizer it implicitly uses) is specified, we will create and use a single lazily-constructed timer, which uses in-JVM synchronization but no external file-based syncing.

Constructor Detail

Generators

public Generators()
Method Detail

randomBasedGenerator

public static RandomBasedGenerator randomBasedGenerator()
Factory method for constructing UUID generator that uses default (shared) random number generator for constructing UUIDs according to standard method number 4.


randomBasedGenerator

public static RandomBasedGenerator randomBasedGenerator(Random rnd)
Factory method for constructing UUID generator that uses specified random number generator for constructing UUIDs according to standard method number 4.


nameBasedGenerator

public static NameBasedGenerator nameBasedGenerator()
Factory method for constructing UUID generator that uses specified random number generator for constructing UUIDs according to standard method number 5, but without using a namespace. Digester to use will be SHA-1 as recommened by UUID spec.


nameBasedGenerator

public static NameBasedGenerator nameBasedGenerator(UUID namespace)
Factory method for constructing UUID generator that uses specified random number generator for constructing UUIDs according to standard method number 5, with specified namespace (or without one if null is specified). Digester to use will be SHA-1 as recommened by UUID spec.

Parameters:
namespace - UUID that represents namespace to use; see NameBasedGenerator for 'standard' namespaces specified by UUID specs

nameBasedGenerator

public static NameBasedGenerator nameBasedGenerator(UUID namespace,
                                                    MessageDigest digester)
Factory method for constructing UUID generator that uses specified random number generator for constructing UUIDs according to standard method number 3 or 5, with specified namespace (or without one if null is specified), using specified digester. If digester is passed as null, a SHA-1 digester will be constructed.

Parameters:
namespace - UUID that represents namespace to use; see NameBasedGenerator for 'standard' namespaces specified by UUID specs
digester - Digester to use; should be a MD5 or SHA-1 digester.

timeBasedGenerator

public static TimeBasedGenerator timeBasedGenerator()
Factory method for constructing UUID generator that generates UUID using variant 1 (time+location based). Since no Ethernet address is passed, a bogus broadcast address will be constructed for purpose of UUID generation; usually it is better to instead access one of host's NIC addresses using EthernetAddress.fromInterface() which will use one of available MAC (Ethernet) addresses available.


timeBasedGenerator

public static TimeBasedGenerator timeBasedGenerator(EthernetAddress ethernetAddress)
Factory method for constructing UUID generator that generates UUID using variant 1 (time+location based), using specified Ethernet address as the location part of UUID. No additional external synchronization is used.


timeBasedGenerator

public static TimeBasedGenerator timeBasedGenerator(EthernetAddress ethernetAddress,
                                                    TimestampSynchronizer sync)
Factory method for constructing UUID generator that generates UUID using variant 1 (time+location based), using specified Ethernet address as the location part of UUID, and specified synchronizer (which may add additional restrictions to guarantee system-wide uniqueness).

Parameters:
ethernetAddress - (optional) MAC address to use; if null, a transient random address is generated.
See Also:
FileBasedTimestampSynchronizer

timeBasedGenerator

public static TimeBasedGenerator timeBasedGenerator(EthernetAddress ethernetAddress,
                                                    UUIDTimer timer)
Factory method for constructing UUID generator that generates UUID using variant 1 (time+location based), using specified Ethernet address as the location part of UUID, and specified UUIDTimer instance (which includes embedded synchronizer that defines synchronization behavior).



Copyright © 2011 FasterXML.com. All Rights Reserved.