public final class ShortSuffixCombFactory extends AbstCombFactory
A Short Suffix COMB GUID is a UUID that combines a creation time with random bits.
The creation minute is a 2 bytes SUFFIX at the LEAST significant bits.
The suffix 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 |
ShortSuffixCombFactory.Builder
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 |
|---|
ShortSuffixCombFactory()
Default constructor.
|
ShortSuffixCombFactory(Clock clock)
Constructor with a clock.
|
ShortSuffixCombFactory(LongSupplier randomFunction)
Constructor with a function which return random numbers.
|
ShortSuffixCombFactory(LongSupplier randomFunction,
Clock clock)
Constructor with a function which a function which return random numbers and
a clock.
|
ShortSuffixCombFactory(Random random)
Constructor with a random.
|
ShortSuffixCombFactory(Random random,
Clock clock)
Constructor with a random and a clock.
|
| Modifier and Type | Method and Description |
|---|---|
static ShortSuffixCombFactory.Builder |
builder()
Returns a new builder.
|
UUID |
create()
Returns a Short Suffix COMB GUID.
|
creategetVersion, nameBytes, nameBytes, namespaceBytes, namespaceBytes, namespaceBytes, toUuidprotected final int interval
protected static final int DEFAULT_INTERVAL
public ShortSuffixCombFactory()
public ShortSuffixCombFactory(Clock clock)
clock - a clockpublic ShortSuffixCombFactory(Random random)
random - a random generatorpublic ShortSuffixCombFactory(Random random, Clock clock)
random - a randomclock - a clockpublic ShortSuffixCombFactory(LongSupplier randomFunction)
randomFunction - a functionpublic ShortSuffixCombFactory(LongSupplier randomFunction, Clock clock)
randomFunction - a functionclock - a clockpublic static ShortSuffixCombFactory.Builder builder()
public UUID create()
create in class UuidFactoryCopyright © 2024. All rights reserved.