Class Generators
- Since:
- 3.0
- Author:
- tatu
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static EthernetAddressThe hardware address of the egress network interface.protected static UUIDTimerIf 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic TimeBasedGeneratorFactory method for constructing UUID generator that generates UUID using version 1 (time+location based).static NameBasedGeneratorFactory method for constructing UUID generator that uses specified random number generator for constructing UUIDs according to standard version 5, but without using a namespace.static NameBasedGeneratornameBasedGenerator(UUID namespace) Factory method for constructing UUID generator that uses specified random number generator for constructing UUIDs according to standard version 5, with specified namespace (or without one if null is specified).static NameBasedGeneratornameBasedGenerator(UUID namespace, MessageDigest digester) Factory method for constructing UUID generator that uses specified random number generator for constructing UUIDs according to standard version 3 or 5, with specified namespace (or without one if null is specified), using specified digester.static RandomBasedGeneratorFactory method for constructing UUID generator that uses default (shared) random number generator for constructing UUIDs according to standard version 4.static RandomBasedGeneratorFactory method for constructing UUID generator that uses specified random number generator for constructing UUIDs according to standard version 4.static TimeBasedEpochGeneratorFactory method for constructing UUID generator that generates UUID using version 7 (Unix Epoch time+random based).static TimeBasedEpochGeneratortimeBasedEpochGenerator(Random random) Factory method for constructing UUID generator that generates UUID using version 7 (Unix Epoch time+random based), using specifiedRandomnumber generator.static TimeBasedEpochGeneratortimeBasedEpochGenerator(Random random, UUIDClock clock) Factory method for constructing UUID generator that generates UUID using version 7 (Unix Epoch time+random based), using specifiedRandomnumber generator.Factory method for constructing UUID generator that generates UUID using version 7 (Unix Epoch time+random based).timeBasedEpochRandomGenerator(Random random) Factory method for constructing UUID generator that generates UUID using version 7 (Unix Epoch time+random based), using specifiedRandomnumber generator.timeBasedEpochRandomGenerator(Random random, UUIDClock clock) Factory method for constructing UUID generator that generates UUID using version 7 (Unix Epoch time+random based), using specifiedRandomnumber generator.static TimeBasedGeneratorFactory method for constructing UUID generator that generates UUID using version 1 (time+location based).static TimeBasedGeneratortimeBasedGenerator(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 TimeBasedGeneratortimeBasedGenerator(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 TimeBasedGeneratortimeBasedGenerator(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 specifiedUUIDTimerinstance (which includes embedded synchronizer that defines synchronization behavior).static TimeBasedReorderedGeneratorFactory method for constructing UUID generator that generates UUID using version 6 (time+location based, reordered for DB locality).static TimeBasedReorderedGeneratortimeBasedReorderedGenerator(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 TimeBasedReorderedGeneratortimeBasedReorderedGenerator(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 specifiedUUIDTimerinstance (which includes embedded synchronizer that defines synchronization behavior).
-
Field Details
-
_preferredIfAddr
The hardware address of the egress network interface.
-
Constructor Details
-
Generators
public Generators()
-
-
Method Details
-
randomBasedGenerator
Factory method for constructing UUID generator that uses default (shared) random number generator for constructing UUIDs according to standard version 4. -
randomBasedGenerator
Factory method for constructing UUID generator that uses specified random number generator for constructing UUIDs according to standard version 4. -
nameBasedGenerator
Factory method for constructing UUID generator that uses specified random number generator for constructing UUIDs according to standard version 5, but without using a namespace. Digester to use will be SHA-1 as recommended by UUID spec. -
nameBasedGenerator
Factory method for constructing UUID generator that uses specified random number generator for constructing UUIDs according to standard version 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; seeNameBasedGeneratorfor 'standard' namespaces specified by UUID specs
-
nameBasedGenerator
Factory method for constructing UUID generator that uses specified random number generator for constructing UUIDs according to standard version 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; seeNameBasedGeneratorfor 'standard' namespaces specified by UUID specsdigester- Digester to use; should be a MD5 or SHA-1 digester.
-
timeBasedEpochGenerator
Factory method for constructing UUID generator that generates UUID using version 7 (Unix Epoch time+random based).NOTE: calls within same millisecond produce very similar values; this may be unsafe in some environments.
No additional external synchronization is used.
-
timeBasedEpochGenerator
Factory method for constructing UUID generator that generates UUID using version 7 (Unix Epoch time+random based), using specifiedRandomnumber generator.NOTE: calls within same millisecond produce very similar values; this may be unsafe in some environments.
No additional external synchronization is used.
-
timeBasedEpochGenerator
Factory method for constructing UUID generator that generates UUID using version 7 (Unix Epoch time+random based), using specifiedRandomnumber generator. Timestamp to use is accessed using specifiedUUIDClock.NOTE: calls within same millisecond produce very similar values; this may be unsafe in some environments.
No additional external synchronization is used.
- Since:
- 4.3
-
timeBasedEpochRandomGenerator
Factory method for constructing UUID generator that generates UUID using version 7 (Unix Epoch time+random based).Calls within same millisecond use additional per-call randomness to try to create more distinct values, compared to
timeBasedEpochGenerator(Random)No additional external synchronization is used.
- Since:
- 5.1
-
timeBasedEpochRandomGenerator
Factory method for constructing UUID generator that generates UUID using version 7 (Unix Epoch time+random based), using specifiedRandomnumber generator.Calls within same millisecond use additional per-call randomness to try to create more distinct values, compared to
timeBasedEpochGenerator(Random)No additional external synchronization is used.
- Since:
- 5.0
-
timeBasedEpochRandomGenerator
public static TimeBasedEpochRandomGenerator timeBasedEpochRandomGenerator(Random random, UUIDClock clock) Factory method for constructing UUID generator that generates UUID using version 7 (Unix Epoch time+random based), using specifiedRandomnumber generator. Timestamp to use is accessed using specifiedUUIDClockCalls within same millisecond use additional per-call randomness to try to create more distinct values, compared to
timeBasedEpochGenerator(Random)No additional external synchronization is used.
- Since:
- 5.0
-
defaultTimeBasedGenerator
Factory method for constructing UUID generator that generates UUID using version 1 (time+location based). This method will use the ethernet address of the interface that routes to the default gateway, or if that cannot be found, then the address of an indeterminately selected non-loopback interface. For most simple and common networking configurations this will be the most appropriate address to use. The default interface is determined by the callingEthernetAddress.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 astimeBasedGenerator(EthernetAddress).- Since:
- 4.2
-
timeBasedGenerator
Factory method for constructing UUID generator that generates UUID using version 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 usingEthernetAddress.fromInterface()which will use one of available MAC (Ethernet) addresses available. -
timeBasedGenerator
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. 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 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).- Parameters:
ethernetAddress- (optional) MAC address to use; if null, a transient random address is generated.- See Also:
-
timeBasedGenerator
public 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 specifiedUUIDTimerinstance (which includes embedded synchronizer that defines synchronization behavior). -
timeBasedReorderedGenerator
Factory method for constructing UUID generator that generates UUID using version 6 (time+location based, reordered for DB locality). 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 usingEthernetAddress.fromInterface()which will use one of available MAC (Ethernet) addresses available. -
timeBasedReorderedGenerator
public 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. No additional external synchronization is used. -
timeBasedReorderedGenerator
public 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 specifiedUUIDTimerinstance (which includes embedded synchronizer that defines synchronization behavior).
-