public class Generators extends Object
Modifier and Type | Field and Description |
---|---|
protected static EthernetAddress |
_preferredIfAddr
The hardware address of the egress network interface.
|
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 and Description |
---|
Generators() |
Modifier and Type | Method and Description |
---|---|
static TimeBasedGenerator |
defaultTimeBasedGenerator()
Factory method for constructing UUID generator that generates UUID using variant 1
(time+location based).
|
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 TimeBasedEpochGenerator |
timeBasedEpochGenerator()
Factory method for constructing UUID generator that generates UUID using
version 7 (Unix Epoch time+random based).
|
static TimeBasedEpochGenerator |
timeBasedEpochGenerator(Random random)
Factory method for constructing UUID generator that generates UUID using
version 7 (time+random based), using specified Ethernet address
as the location part of UUID.
|
static TimeBasedGenerator |
timeBasedGenerator()
Factory method for constructing UUID generator that generates UUID using
version 1 (time+location based).
|
static TimeBasedGenerator |
timeBasedGenerator(EthernetAddress ethernetAddress)
Factory method for constructing UUID generator that generates UUID using
version 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
version 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
version 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). |
static TimeBasedReorderedGenerator |
timeBasedReorderedGenerator()
Factory method for constructing UUID generator that generates UUID using
version 6 (time+location based, reordered for DB locality).
|
static TimeBasedReorderedGenerator |
timeBasedReorderedGenerator(EthernetAddress ethernetAddress)
Factory method for constructing UUID generator that generates UUID using
version 6 (time+location based, reordered for DB locality), using specified
Ethernet address as the location part of UUID.
|
static TimeBasedReorderedGenerator |
timeBasedReorderedGenerator(EthernetAddress ethernetAddress,
UUIDTimer timer)
Factory method for constructing UUID generator that generates UUID using
version 6 (time+location based, reordered for DB locality), using specified
Ethernet address as the location part of UUID, and specified
UUIDTimer instance (which includes embedded synchronizer that defines
synchronization behavior). |
protected static UUIDTimer _sharedTimer
protected static EthernetAddress _preferredIfAddr
public static RandomBasedGenerator randomBasedGenerator()
public static RandomBasedGenerator randomBasedGenerator(Random rnd)
public static NameBasedGenerator nameBasedGenerator()
public static NameBasedGenerator nameBasedGenerator(UUID namespace)
namespace
- UUID that represents namespace to use; see
NameBasedGenerator
for 'standard' namespaces specified by
UUID specspublic static NameBasedGenerator nameBasedGenerator(UUID namespace, MessageDigest digester)
namespace
- UUID that represents namespace to use; see
NameBasedGenerator
for 'standard' namespaces specified by
UUID specsdigester
- Digester to use; should be a MD5 or SHA-1 digester.public static TimeBasedEpochGenerator timeBasedEpochGenerator()
public static TimeBasedEpochGenerator timeBasedEpochGenerator(Random random)
public static TimeBasedGenerator defaultTimeBasedGenerator()
EthernetAddress.fromPreferredInterface()
method. Note that this will only
identify the preferred interface once: if you have a complex network setup where
your outbound routes/interfaces may change dynamically. If you want your UUIDs to
accurately reflect a deterministic selection of network interface, you should
instead use a generator implementation that uses an explicitly specified address,
such as timeBasedGenerator(EthernetAddress)
.public static TimeBasedGenerator timeBasedGenerator()
EthernetAddress.fromInterface()
which will use one of available
MAC (Ethernet) addresses available.public static TimeBasedGenerator timeBasedGenerator(EthernetAddress ethernetAddress)
public static TimeBasedGenerator timeBasedGenerator(EthernetAddress ethernetAddress, TimestampSynchronizer sync)
ethernetAddress
- (optional) MAC address to use; if null, a transient
random address is generated.FileBasedTimestampSynchronizer
public static TimeBasedGenerator timeBasedGenerator(EthernetAddress ethernetAddress, UUIDTimer timer)
UUIDTimer
instance
(which includes embedded synchronizer that defines synchronization behavior).public static TimeBasedReorderedGenerator timeBasedReorderedGenerator()
EthernetAddress.fromInterface()
which will use one of
available MAC (Ethernet) addresses available.public static TimeBasedReorderedGenerator timeBasedReorderedGenerator(EthernetAddress ethernetAddress)
public static TimeBasedReorderedGenerator timeBasedReorderedGenerator(EthernetAddress ethernetAddress, UUIDTimer timer)
UUIDTimer
instance (which includes embedded synchronizer that defines
synchronization behavior).Copyright © 2023 FasterXML.com. All rights reserved.