public final class ShortPrefixCombFactory extends AbstCombFactory
A Short Prefix COMB GUID is a UUID that combines a creation time with random bits.
The creation minute is a 2 bytes PREFIX at the MOST significant bits.
The prefix wraps around every ~45 days (2^16/60/24 = ~45).
The created UUID is a UUIDv4 for compatibility with RFC 9562.
| Modifier and Type | Class and Description |
|---|---|
static class |
ShortPrefixCombFactory.Builder
A builder of factories.
|
AbstRandomBasedFactory.FastRandom, AbstRandomBasedFactory.IRandom, AbstRandomBasedFactory.SafeRandomUuidFactory.Parameters| Modifier and Type | Field and Description |
|---|---|
protected static int |
DEFAULT_INTERVAL
Default interval of 60 seconds in milliseconds.
|
protected int |
interval
Interval in milliseconds.
|
timeFunctionlock, random, UUID_BYTESversion, versionMask| Constructor and Description |
|---|
ShortPrefixCombFactory()
Default constructor.
|
ShortPrefixCombFactory(Clock clock)
Constructor with a clock.
|
ShortPrefixCombFactory(LongSupplier randomFunction)
Constructor with a function which return random numbers.
|
ShortPrefixCombFactory(LongSupplier randomFunction,
Clock clock)
Constructor with a function which a function which return random numbers and
a clock.
|
ShortPrefixCombFactory(Random random)
Constructor with a random.
|
ShortPrefixCombFactory(Random random,
Clock clock)
Constructor with a random and a clock.
|
| Modifier and Type | Method and Description |
|---|---|
static ShortPrefixCombFactory.Builder |
builder()
Returns a new builder.
|
UUID |
create()
Returns a Short Prefix COMB GUID.
|
creategetVersion, nameBytes, nameBytes, namespaceBytes, namespaceBytes, namespaceBytes, toUuidprotected final int interval
protected static final int DEFAULT_INTERVAL
public ShortPrefixCombFactory()
public ShortPrefixCombFactory(Clock clock)
clock - a clockpublic ShortPrefixCombFactory(Random random)
random - a random generatorpublic ShortPrefixCombFactory(Random random, Clock clock)
random - a randomclock - a clockpublic ShortPrefixCombFactory(LongSupplier randomFunction)
randomFunction - a functionpublic ShortPrefixCombFactory(LongSupplier randomFunction, Clock clock)
randomFunction - a functionclock - a clockpublic static ShortPrefixCombFactory.Builder builder()
public UUID create()
create in class UuidFactoryCopyright © 2024. All rights reserved.