Module com.github.f4b6a3.uuid
Class PrefixCombFactory
- 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.PrefixCombFactory
-
public final class PrefixCombFactory extends AbstCombFactory
Concrete factory for creating Prefix COMB GUIDs.A Prefix COMB GUID is a UUID that combines a creation time with random bits.
The creation millisecond is a 6 bytes PREFIX at the MOST significant bits.
The created UUID is a UUIDv4 for compatibility with RFC 9562.
- See Also:
- The Cost of GUIDs as Primary Keys
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPrefixCombFactory.BuilderBuilder 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 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 PrefixCombFactory()Default constructor.PrefixCombFactory(Clock clock)Constructor with a clock.PrefixCombFactory(LongSupplier randomFunction)Constructor with a function which return random numbers.PrefixCombFactory(LongSupplier randomFunction, Clock clock)Constructor with a function which a function which return random numbers and a clock.PrefixCombFactory(Random random)Constructor with a random.PrefixCombFactory(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 PrefixCombFactory.Builderbuilder()Returns a new builder.UUIDcreate()Returns a 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
-
-
-
-
Constructor Detail
-
PrefixCombFactory
public PrefixCombFactory()
Default constructor.
-
PrefixCombFactory
public PrefixCombFactory(Clock clock)
Constructor with a clock.- Parameters:
clock- a clock
-
PrefixCombFactory
public PrefixCombFactory(Random random)
Constructor with a random.- Parameters:
random- a random generator
-
PrefixCombFactory
public PrefixCombFactory(Random random, Clock clock)
Constructor with a random and a clock.- Parameters:
random- a randomclock- a clock
-
PrefixCombFactory
public PrefixCombFactory(LongSupplier randomFunction)
Constructor with a function which return random numbers.- Parameters:
randomFunction- a function
-
PrefixCombFactory
public PrefixCombFactory(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 PrefixCombFactory.Builder builder()
Returns a new builder.- Returns:
- a builder
-
create
public UUID create()
Returns a Prefix COMB GUID.- Specified by:
createin classUuidFactory- Returns:
- a UUIDv4
-
-