Module com.github.f4b6a3.uuid
Class ShortPrefixCombFactory
- java.lang.Object
-
- com.github.f4b6a3.uuid.factory.UuidFactory
-
- com.github.f4b6a3.uuid.factory.AbstRandomBasedFactory
-
- com.github.f4b6a3.uuid.factory.AbstCombFactory
-
- com.github.f4b6a3.uuid.factory.nonstandard.ShortPrefixCombFactory
-
public final class ShortPrefixCombFactory extends AbstCombFactory
Concrete factory for creating Short Prefix COMB GUIDs.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.
- See Also:
- Sequential UUID Generators
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classShortPrefixCombFactory.BuilderA builder of factories.-
Nested classes/interfaces inherited from class com.github.f4b6a3.uuid.factory.AbstRandomBasedFactory
AbstRandomBasedFactory.FastRandom, AbstRandomBasedFactory.IRandom, AbstRandomBasedFactory.SafeRandom
-
Nested classes/interfaces inherited from class com.github.f4b6a3.uuid.factory.UuidFactory
UuidFactory.Parameters
-
-
Field Summary
Fields Modifier and Type Field Description protected static intDEFAULT_INTERVALDefault interval of 60 seconds in milliseconds.protected intintervalInterval in milliseconds.-
Fields inherited from class com.github.f4b6a3.uuid.factory.AbstCombFactory
instantFunction
-
Fields inherited from class com.github.f4b6a3.uuid.factory.AbstRandomBasedFactory
lock, random, UUID_BYTES
-
Fields inherited from class com.github.f4b6a3.uuid.factory.UuidFactory
version, versionMask
-
-
Constructor Summary
Constructors Constructor 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.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ShortPrefixCombFactory.Builderbuilder()Returns a new builder.UUIDcreate()Returns a Short Prefix COMB GUID.-
Methods inherited from class com.github.f4b6a3.uuid.factory.AbstRandomBasedFactory
create
-
Methods inherited from class com.github.f4b6a3.uuid.factory.UuidFactory
getVersion, nameBytes, nameBytes, namespaceBytes, namespaceBytes, namespaceBytes, toUuid
-
-
-
-
Field Detail
-
interval
protected final int interval
Interval in milliseconds.
-
DEFAULT_INTERVAL
protected static final int DEFAULT_INTERVAL
Default interval of 60 seconds in milliseconds.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ShortPrefixCombFactory
public ShortPrefixCombFactory()
Default constructor.
-
ShortPrefixCombFactory
public ShortPrefixCombFactory(Clock clock)
Constructor with a clock.- Parameters:
clock- a clock
-
ShortPrefixCombFactory
public ShortPrefixCombFactory(Random random)
Constructor with a random.- Parameters:
random- a random generator
-
ShortPrefixCombFactory
public ShortPrefixCombFactory(Random random, Clock clock)
Constructor with a random and a clock.- Parameters:
random- a randomclock- a clock
-
ShortPrefixCombFactory
public ShortPrefixCombFactory(LongSupplier randomFunction)
Constructor with a function which return random numbers.- Parameters:
randomFunction- a function
-
ShortPrefixCombFactory
public ShortPrefixCombFactory(LongSupplier randomFunction, Clock clock)
Constructor with a function which a function which return random numbers and a clock.- Parameters:
randomFunction- a functionclock- a clock
-
-
Method Detail
-
builder
public static ShortPrefixCombFactory.Builder builder()
Returns a new builder.- Returns:
- a builder
-
create
public UUID create()
Returns a Short Prefix COMB GUID.- Specified by:
createin classUuidFactory- Returns:
- a UUIDv4
-
-