public final class UuidCreator extends Object
All UUID types can be generated from this entry point.
| Modifier and Type | Field and Description |
|---|---|
static UuidLocalDomain |
LOCAL_DOMAIN_GROUP
The group domain, interpreted as POSIX GID domain on POSIX systems.
|
static UuidLocalDomain |
LOCAL_DOMAIN_ORG
The organization domain, site-defined.
|
static UuidLocalDomain |
LOCAL_DOMAIN_PERSON
The principal domain, interpreted as POSIX UID domain on POSIX systems.
|
static UuidNamespace |
NAMESPACE_DNS
Name space to be used when the name string is a fully-qualified domain name.
|
static UuidNamespace |
NAMESPACE_OID
Name space to be used when the name string is an ISO OID.
|
static UuidNamespace |
NAMESPACE_URL
Name space to be used when the name string is a URL.
|
static UuidNamespace |
NAMESPACE_X500
Name space to be used when the name string is an X.500 DN (DER or text).
|
| Modifier and Type | Method and Description |
|---|---|
static UUID |
fromBytes(byte[] uuid)
Returns a UUID from a byte array.
|
static UUID |
fromString(String uuid)
Returns a UUID from a string.
|
static UUID |
getDceSecurity(byte localDomain,
int localIdentifier)
Returns a DCE Security unique identifier (UUIDv2).
|
static UUID |
getDceSecurity(UuidLocalDomain localDomain,
int localIdentifier)
Returns a DCE Security unique identifier (UUIDv2).
|
static UUID |
getDceSecurityWithHash(byte localDomain,
int localIdentifier)
Returns a DCE Security unique identifier (UUIDv2).
|
static UUID |
getDceSecurityWithHash(UuidLocalDomain localDomain,
int localIdentifier)
Returns a DCE Security unique identifier (UUIDv2).
|
static UUID |
getDceSecurityWithMac(byte localDomain,
int localIdentifier)
Returns a DCE Security unique identifier (UUIDv2).
|
static UUID |
getDceSecurityWithMac(UuidLocalDomain localDomain,
int localIdentifier)
Returns a DCE Security unique identifier (UUIDv2).
|
static UUID |
getDceSecurityWithRandom(byte localDomain,
int localIdentifier)
Returns a DCE Security unique identifier (UUIDv2).
|
static UUID |
getDceSecurityWithRandom(UuidLocalDomain localDomain,
int localIdentifier)
Returns a DCE Security unique identifier (UUIDv2).
|
static UUID |
getMax()
Returns a Max UUID.
|
static UUID |
getNameBasedMd5(byte[] name)
Returns a name-based unique identifier that uses MD5 hashing (UUIDv3).
|
static UUID |
getNameBasedMd5(String name)
Returns a name-based unique identifier that uses MD5 hashing (UUIDv3).
|
static UUID |
getNameBasedMd5(String namespace,
byte[] name)
Returns a name-based unique identifier that uses MD5 hashing (UUIDv3).
|
static UUID |
getNameBasedMd5(String namespace,
String name)
Returns a name-based unique identifier that uses MD5 hashing (UUIDv3).
|
static UUID |
getNameBasedMd5(UUID namespace,
byte[] name)
Returns a name-based unique identifier that uses MD5 hashing (UUIDv3).
|
static UUID |
getNameBasedMd5(UuidNamespace namespace,
byte[] name)
Returns a name-based unique identifier that uses MD5 hashing (UUIDv3).
|
static UUID |
getNameBasedMd5(UuidNamespace namespace,
String name)
Returns a name-based unique identifier that uses MD5 hashing (UUIDv3).
|
static UUID |
getNameBasedMd5(UUID namespace,
String name)
Returns a name-based unique identifier that uses MD5 hashing (UUIDv3).
|
static UUID |
getNameBasedSha1(byte[] name)
Returns a name-based unique identifier that uses SHA-1 hashing (UUIDv5).
|
static UUID |
getNameBasedSha1(String name)
Returns a name-based unique identifier that uses SHA-1 hashing (UUIDv5).
|
static UUID |
getNameBasedSha1(String namespace,
byte[] name)
Returns a name-based unique identifier that uses SHA-1 hashing (UUIDv5).
|
static UUID |
getNameBasedSha1(String namespace,
String name)
Returns a name-based unique identifier that uses SHA-1 hashing (UUIDv5).
|
static UUID |
getNameBasedSha1(UUID namespace,
byte[] name)
Returns a name-based unique identifier that uses SHA-1 hashing (UUIDv5).
|
static UUID |
getNameBasedSha1(UuidNamespace namespace,
byte[] name)
Returns a name-based unique identifier that uses SHA-1 hashing (UUIDv5).
|
static UUID |
getNameBasedSha1(UuidNamespace namespace,
String name)
Returns a name-based unique identifier that uses SHA-1 hashing (UUIDv5).
|
static UUID |
getNameBasedSha1(UUID namespace,
String name)
Returns a name-based unique identifier that uses SHA-1 hashing (UUIDv5).
|
static UUID |
getNil()
Returns a Nil UUID.
|
static UUID |
getPrefixComb()
Returns a Prefix COMB GUID.
|
static UUID |
getPrefixCombMax(Instant instant)
Returns the maximum Prefix COMB GUID for a given instant.
|
static UUID |
getPrefixCombMin(Instant instant)
Returns the minimum Prefix COMB GUID for a given instant.
|
static UUID |
getRandomBased()
Returns a random-based unique identifier (UUIDv4).
|
static UUID |
getRandomBasedFast()
Returns a fast random-based unique identifier (UUIDv4).
|
static UUID |
getShortPrefixComb()
Returns n Short Prefix COMB GUID.
|
static UUID |
getShortSuffixComb()
Returns a Short Suffix COMB GUID.
|
static UUID |
getSuffixComb()
Returns a Suffix COMB GUID.
|
static UUID |
getSuffixCombMax(Instant instant)
Returns the maximum Suffix COMB GUID for a given instant.
|
static UUID |
getSuffixCombMin(Instant instant)
Returns the minimum Suffix COMB GUID for a given instant.
|
static UUID |
getTimeBased()
Returns a time-based unique identifier (UUIDv1).
|
static UUID |
getTimeBased(Instant instant,
Integer clockseq,
Long nodeid)
Returns a time-based unique identifier (UUIDv1).
|
static UUID |
getTimeBasedMax(Instant instant)
Returns the maximum UUIDv1 for a given instant.
|
static UUID |
getTimeBasedMin(Instant instant)
Returns the minimum UUIDv1 for a given instant.
|
static UUID |
getTimeBasedWithHash()
Returns a time-based unique identifier (UUIDv1).
|
static UUID |
getTimeBasedWithMac()
Returns a time-based unique identifier (UUIDv1).
|
static UUID |
getTimeBasedWithRandom()
Returns a time-based unique identifier (UUIDv1).
|
static UUID |
getTimeOrdered()
Returns a time-ordered unique identifier (UUIDv6).
|
static UUID |
getTimeOrdered(Instant instant,
Integer clockseq,
Long nodeid)
Returns a time-ordered unique identifier (UUIDv6).
|
static UUID |
getTimeOrderedEpoch()
Returns a time-ordered unique identifier that uses Unix Epoch (UUIDv7).
|
static UUID |
getTimeOrderedEpoch(Instant instant)
Returns a time-ordered unique identifier that uses Unix Epoch (UUIDv7) for a
given instant.
|
static UUID |
getTimeOrderedEpochFast()
Returns a fast time-ordered unique identifier that uses Unix Epoch (UUIDv7).
|
static UUID |
getTimeOrderedEpochMax(Instant instant)
Returns the maximum UUIDv7 for a given instant.
|
static UUID |
getTimeOrderedEpochMin(Instant instant)
Returns the minimum UUIDv7 for a given instant.
|
static UUID |
getTimeOrderedEpochPlus1()
Returns a time-ordered unique identifier that uses Unix Epoch (UUIDv7).
|
static UUID |
getTimeOrderedEpochPlusN()
Returns a time-ordered unique identifier that uses Unix Epoch (UUIDv7).
|
static UUID |
getTimeOrderedMax(Instant instant)
Returns the maximum UUIDv6 for a given instant.
|
static UUID |
getTimeOrderedMin(Instant instant)
Returns the minimum UUIDv6 for a given instant.
|
static UUID |
getTimeOrderedWithHash()
Returns a time-ordered unique identifier (UUIDv6).
|
static UUID |
getTimeOrderedWithMac()
Returns a time-ordered unique identifier (UUIDv6).
|
static UUID |
getTimeOrderedWithRandom()
Returns a time-ordered unique identifier (UUIDv6).
|
static byte[] |
toBytes(UUID uuid)
Returns an array of bytes from a UUID.
|
static String |
toString(UUID uuid)
Returns a string from a UUID.
|
public static final UuidNamespace NAMESPACE_DNS
public static final UuidNamespace NAMESPACE_URL
public static final UuidNamespace NAMESPACE_OID
public static final UuidNamespace NAMESPACE_X500
public static final UuidLocalDomain LOCAL_DOMAIN_PERSON
public static final UuidLocalDomain LOCAL_DOMAIN_GROUP
public static final UuidLocalDomain LOCAL_DOMAIN_ORG
public static UUID getNil()
Nil UUID is a special UUID that has all 128 bits set to ZERO.
The canonical string of Nil UUID is
00000000-0000-0000-0000-000000000000.
public static UUID getMax()
Max UUID is a special UUID that has all 128 bits set to ONE.
The canonical string of Max UUID is
FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF.
public static byte[] toBytes(UUID uuid)
uuid - a UUIDInvalidUuidException - if the argument is invalidpublic static UUID fromBytes(byte[] uuid)
It also checks if the input byte array is valid.
uuid - a byte arrayInvalidUuidException - if the argument is invalidpublic static String toString(UUID uuid)
It can be much faster than UUID.toString() in JDK 8.
uuid - a UUIDInvalidUuidException - if the argument is invalidpublic static UUID fromString(String uuid)
It accepts strings:
It can be much faster than UUID.fromString(String) in JDK 8.
It also can be twice as fast as UUID.fromString(String) in JDK 11.
uuid - a UUID stringInvalidUuidException - if the argument is invalidpublic static UUID getRandomBased()
RandomBasedFactorypublic static UUID getRandomBasedFast()
It employs ThreadLocalRandom which works very well, although not
cryptographically strong. It can be useful, for example, for logging.
Security-sensitive applications that require a cryptographically secure
pseudo-random generator should use getRandomBased().
RandomBasedFactory,
ThreadLocalRandompublic static UUID getTimeBased()
The default node identifier is a random number that is generated once at initialization.
A custom node identifier can be provided by the system property 'uuidcreator.node' or the environment variable 'UUIDCREATOR_NODE'.
TimeBasedFactorypublic static UUID getTimeBasedWithMac()
The node identifier is a MAC address that is obtained once at initialization.
TimeBasedFactorypublic static UUID getTimeBasedWithHash()
The node identifier is a hash that is calculated once at initialization.
The hash input is a string containing host name, MAC and IP.
TimeBasedFactory,
MachineIdpublic static UUID getTimeBasedWithRandom()
The node identifier is a random number that is generated with each method invocation.
TimeBasedFactorypublic static UUID getTimeBased(Instant instant, Integer clockseq, Long nodeid)
Instant accuracy is be limited to 1 millisecond on Linux with JDK 8.
On Windows, its accuracy may be limited to 15.625ms (64hz).
The clock sequence is a number between 0 and 16383 (2^14 - 1). If the value passed as an argument is out of range, the result of MOD 2^14 will be used.
The node identifier is a number between 0 and 281474976710655 (2^48 - 1). If the value passed as an argument is out of range, the result of MOD 2^48 will be used.
Null arguments are ignored. If all arguments are null, this method works just
like method getTimeBased().
instant - an alternate instantclockseq - an alternate clock sequence between 0 and 2^14-1nodeid - an alternate node identifier between 0 and 2^48-1TimeBasedFactorypublic static UUID getTimeBasedMin(Instant instant)
The 60 bits of the timestamp are filled with the bits of the given instant and the other 62 bits are all set to ZERO.
For example, the minimum UUIDv1 for 2022-02-22 22:22:22.222 is
`e7a1c2e0-942d-11ec-8000-000000000000`, where
`e7a1c2e0-942d-_1ec` is the timestamp in hexadecimal.
It can be useful to find all records before or after a specific timestamp in
a table without a `created_at` field.
instant - a given instantpublic static UUID getTimeBasedMax(Instant instant)
The 60 bits of the timestamp are filled with the bits of the given instant and the other 62 bits are all set to ONE.
For example, the maximum UUIDv1 for 2022-02-22 22:22:22.222 is
`e7a1c2e0-942d-11ec-bfff-ffffffffffff`, where
`e7a1c2e0-942d-_1ec` is the timestamp in hexadecimal.
It can be useful to find all records before or after a specific timestamp in
a table without a `created_at` field.
instant - a given instantpublic static UUID getTimeOrdered()
The default node identifier is a random number that is generated once at initialization.
A custom node identifier can be provided by the system property 'uuidcreator.node' or the environment variable 'UUIDCREATOR_NODE'.
TimeOrderedFactory,
New
UUID Formatspublic static UUID getTimeOrderedWithMac()
The node identifier is a MAC address that is obtained once at initialization.
TimeOrderedFactory,
New
UUID Formatspublic static UUID getTimeOrderedWithHash()
The node identifier is a hash that is calculated once at initialization.
The hash input is a string containing host name, MAC and IP.
TimeOrderedFactory,
MachineId,
New
UUID Formatspublic static UUID getTimeOrderedWithRandom()
The node identifier is a random number that is generated with each method invocation.
TimeOrderedFactory,
New
UUID Formatspublic static UUID getTimeOrdered(Instant instant, Integer clockseq, Long nodeid)
Instant accuracy is be limited to 1 millisecond on Linux with JDK 8.
On Windows, its accuracy may be limited to 15.625ms (64hz).
The clock sequence is a number between 0 and 16383 (2^14 - 1). If the value passed as an argument is out of range, the result of MOD 2^14 will be used.
The node identifier is a number between 0 and 281474976710655 (2^48 - 1). If the value passed as an argument is out of range, the result of MOD 2^48 will be used.
Null arguments are ignored. If all arguments are null, this method works just
like method getTimeOrdered().
instant - an alternate instantclockseq - an alternate clock sequence between 0 and 2^14-1nodeid - an alternate node identifier between 0 and 2^48-1TimeOrderedFactory,
New
UUID Formatspublic static UUID getTimeOrderedMin(Instant instant)
The 60 bits of the timestamp are filled with the bits of the given instant and the other 62 bits are all set to ZERO.
For example, the minimum UUIDv6 for 2022-02-22 22:22:22.222 is
`1ec942de-7a1c-62e0-8000-000000000000`, where
`1ec942de-7a1c-_2e0` is the timestamp in hexadecimal.
It can be useful to find all records before or after a specific timestamp in
a table without a `created_at` field.
instant - a given instantpublic static UUID getTimeOrderedMax(Instant instant)
The 60 bits of the timestamp are filled with the bits of the given instant and the other 62 bits are all set to ONE.
For example, the maximum UUIDv6 for 2022-02-22 22:22:22.222 is
`1ec942de-7a1c-62e0-bfff-ffffffffffff`, where
`1ec942de-7a1c-_2e0` is the timestamp in hexadecimal.
It can be useful to find all records before or after a specific timestamp in
a table without a `created_at` field.
instant - a given instantpublic static UUID getTimeOrderedEpoch()
This method produces identifiers with 3 parts: time, counter and random.
The counter bits are incremented by 1 when the time repeats.
The random bits are generated with each method invocation.
TimeOrderedEpochFactory,
New
UUID Formatspublic static UUID getTimeOrderedEpochFast()
This method produces identifiers with 3 parts: time, counter and random.
The counter bits are incremented by 1 when the time repeats.
The random bits are generated with each method invocation.
It employs ThreadLocalRandom which works very well, although not
cryptographically strong. It can be useful, for example, for logging.
Security-sensitive applications that require a cryptographically secure
pseudo-random generator should use getTimeOrderedEpoch().
TimeOrderedEpochFactory,
New
UUID Formatspublic static UUID getTimeOrderedEpochPlus1()
This method produces identifiers with 2 parts: time and monotonic random.
The monotonic random bits are incremented by 1 when the time repeats.
TimeOrderedEpochFactory,
New
UUID Formatspublic static UUID getTimeOrderedEpochPlusN()
This method produces identifiers with 2 parts: time and monotonic random.
The monotonic random bits are incremented by a random number between 1 and 2^32 when the time repeats.
TimeOrderedEpochFactory,
New
UUID Formatspublic static UUID getTimeOrderedEpoch(Instant instant)
This method produces identifiers with 2 parts: time and secure random.
The 48 bits of the time component are filled with the bits of the given instant and the other 74 bits are random.
For example, the maximum UUIDv7 for 2022-02-22 22:22:22.222 is
`017f2387-460e-7012-b345-6789abcdef01`, where `017f2387-460e`
is the timestamp in hexadecimal.
The random bits are generated with each method invocation.
instant - a given instantpublic static UUID getTimeOrderedEpochMin(Instant instant)
The 48 bits of the time component are filled with the bits of the given instant and the other 74 bits are all set to ZERO.
For example, the minimum UUIDv7 for 2022-02-22 22:22:22.222 is
`017f2387-460e-7000-8000-000000000000`, where `017f2387-460e`
is the timestamp in hexadecimal.
It can be useful to find all records before or after a specific timestamp in
a table without a `created_at` field.
instant - a given instantpublic static UUID getTimeOrderedEpochMax(Instant instant)
The 48 bits of the time component are filled with the bits of the given instant and the other 74 bits are all set to ONE.
For example, the maximum UUIDv7 for 2022-02-22 22:22:22.222 is
`017f2387-460e-7fff-bfff-ffffffffffff`, where `017f2387-460e`
is the timestamp in hexadecimal.
It can be useful to find all records before or after a specific timestamp in
a table without a `created_at` field.
instant - a given instantpublic static UUID getNameBasedMd5(String name)
The name string is encoded into a sequence of bytes using UTF-8.
name - a stringNameBasedMd5Factorypublic static UUID getNameBasedMd5(byte[] name)
name - a byte arrayNameBasedMd5Factorypublic static UUID getNameBasedMd5(UUID namespace, String name)
The name string is encoded into a sequence of bytes using UTF-8.
namespace - a custom name space UUIDname - a stringUuidNamespace,
NameBasedMd5Factorypublic static UUID getNameBasedMd5(UUID namespace, byte[] name)
namespace - a custom name space UUIDname - a byte arrayUuidNamespace,
NameBasedMd5Factorypublic static UUID getNameBasedMd5(String namespace, String name)
The name string is encoded into a sequence of bytes using UTF-8.
namespace - a custom name space UUID in string formatname - a stringInvalidUuidException - if namespace is invalidUuidNamespace,
NameBasedMd5Factorypublic static UUID getNameBasedMd5(String namespace, byte[] name)
namespace - a custom name space UUID in string formatname - a byte arrayInvalidUuidException - if namespace is invalidUuidNamespace,
NameBasedMd5Factorypublic static UUID getNameBasedMd5(UuidNamespace namespace, String name)
The name string is encoded into a sequence of bytes using UTF-8.
Name spaces predefined by RFC 9562 (Appendix C):
namespace - a predefined name space enumerationname - a stringUuidNamespace,
NameBasedMd5Factorypublic static UUID getNameBasedMd5(UuidNamespace namespace, byte[] name)
Name spaces predefined by RFC 9562 (Appendix C):
namespace - a predefined name space enumerationname - a byte arrayUuidNamespace,
NameBasedMd5Factorypublic static UUID getNameBasedSha1(String name)
The name string is encoded into a sequence of bytes using UTF-8.
name - a stringNameBasedSha1Factorypublic static UUID getNameBasedSha1(byte[] name)
name - a byte arrayNameBasedSha1Factorypublic static UUID getNameBasedSha1(UUID namespace, String name)
The name string is encoded into a sequence of bytes using UTF-8.
namespace - a custom name space UUIDname - a stringUuidNamespace,
NameBasedSha1Factorypublic static UUID getNameBasedSha1(UUID namespace, byte[] name)
namespace - a custom name space UUIDname - a byte arrayUuidNamespace,
NameBasedSha1Factorypublic static UUID getNameBasedSha1(String namespace, String name)
The name string is encoded into a sequence of bytes using UTF-8.
namespace - a custom name space UUID in string formatname - a stringInvalidUuidException - if namespace is invalidUuidNamespace,
NameBasedSha1Factorypublic static UUID getNameBasedSha1(String namespace, byte[] name)
namespace - a custom name space UUID in string formatname - a byte arrayInvalidUuidException - if namespace is invalidUuidNamespace,
NameBasedSha1Factorypublic static UUID getNameBasedSha1(UuidNamespace namespace, String name)
The name string is encoded into a sequence of bytes using UTF-8.
Name spaces predefined by RFC 9562 (Appendix C):
namespace - a predefined name space enumerationname - a stringUuidNamespace,
NameBasedSha1Factorypublic static UUID getNameBasedSha1(UuidNamespace namespace, byte[] name)
Name spaces predefined by RFC 9562 (Appendix C):
namespace - a predefined name space enumerationname - a byte arrayUuidNamespace,
NameBasedSha1Factorypublic static UUID getDceSecurity(byte localDomain, int localIdentifier)
localDomain - a custom local domain bytelocalIdentifier - a local identifierUuidLocalDomain,
DceSecurityFactorypublic static UUID getDceSecurityWithMac(byte localDomain, int localIdentifier)
localDomain - a custom local domain bytelocalIdentifier - a local identifierUuidLocalDomain,
DceSecurityFactorypublic static UUID getDceSecurityWithHash(byte localDomain, int localIdentifier)
localDomain - a custom local domain bytelocalIdentifier - a local identifierUuidLocalDomain,
DceSecurityFactorypublic static UUID getDceSecurityWithRandom(byte localDomain, int localIdentifier)
localDomain - a custom local domain bytelocalIdentifier - a local identifierUuidLocalDomain,
DceSecurityFactorypublic static UUID getDceSecurity(UuidLocalDomain localDomain, int localIdentifier)
Local domains predefined by DCE 1.1 Authentication and Security Services (Chapter 11):
localDomain - a predefined local domain enumerationlocalIdentifier - a local identifierUuidLocalDomain,
DceSecurityFactorypublic static UUID getDceSecurityWithMac(UuidLocalDomain localDomain, int localIdentifier)
Local domains predefined by DCE 1.1 Authentication and Security Services (Chapter 11):
localDomain - a predefined local domain enumerationlocalIdentifier - a local identifierUuidLocalDomain,
DceSecurityFactorypublic static UUID getDceSecurityWithHash(UuidLocalDomain localDomain, int localIdentifier)
Local domains predefined by DCE 1.1 Authentication and Security Services (Chapter 11):
localDomain - a predefined local domain enumerationlocalIdentifier - a local identifierUuidLocalDomain,
DceSecurityFactorypublic static UUID getDceSecurityWithRandom(UuidLocalDomain localDomain, int localIdentifier)
Local domains predefined by DCE 1.1 Authentication and Security Services (Chapter 11):
localDomain - a predefined local domain enumerationlocalIdentifier - a local identifierUuidLocalDomain,
DceSecurityFactorypublic static UUID getPrefixComb()
The creation millisecond is a 6 bytes PREFIX is at the MOST significant bits.
PrefixCombFactory,
The Cost
of GUIDs as Primary Keyspublic static UUID getPrefixCombMin(Instant instant)
The 48 bits of the time component are filled with the bits of the given instant and the other 74 bits are all set to ZERO.
For example, the minimum GUID for 2022-02-22 22:22:22.222 is
`017f2387-460e-4000-8000-000000000000`, where `017f2387-460e`
is the timestamp in hexadecimal.
It can be useful to find all records before or after a specific timestamp in
a table without a `created_at` field.
instant - a given instantpublic static UUID getPrefixCombMax(Instant instant)
The 48 bits of the time component are filled with the bits of the given instant and the other 74 bits are all set to ONE.
For example, the maximum GUID for 2022-02-22 22:22:22.222 is
`017f2387-460e-4fff-bfff-ffffffffffff`, where `017f2387-460e`
is the timestamp in hexadecimal.
It can be useful to find all records before or after a specific timestamp in
a table without a `created_at` field.
instant - a given instantpublic static UUID getSuffixComb()
SuffixCombFactory,
The Cost
of GUIDs as Primary Keyspublic static UUID getSuffixCombMin(Instant instant)
The 48 bits of the time component are filled with the bits of the given instant and the other 74 bits are all set to ZERO.
For example, the minimum GUID for 2022-02-22 22:22:22.222 is
`00000000-0000-4000-8000-017f2387460e`, where `017f2387460e`
is the timestamp in hexadecimal.
It can be useful to find all records before or after a specific timestamp in
a table without a `created_at` field.
instant - a given instantpublic static UUID getSuffixCombMax(Instant instant)
The 48 bits of the time component are filled with the bits of the given instant and the other 74 bits are all set to ONE.
For example, the maximum GUID for 2022-02-22 22:22:22.222 is
`ffffffff-ffff-4fff-bfff-017f2387460e`, where `017f2387460e`
is the timestamp in hexadecimal.
It can be useful to find all records before or after a specific timestamp in
a table without a `created_at` field.
instant - a given instantpublic static UUID getShortPrefixComb()
The creation minute is a 2 bytes PREFIX is at the MOST significant bits.
The prefix wraps around every ~45 days (2^16/60/24 = ~45).
ShortPrefixCombFactory,
Sequential
UUID Generatorspublic static UUID getShortSuffixComb()
The creation minute is a 2 bytes SUFFIX is at the LEAST significant bits.
The suffix wraps around every ~45 days (2^16/60/24 = ~45).
ShortSuffixCombFactory,
Sequential
UUID GeneratorsCopyright © 2024. All rights reserved.