Class TimeBasedUuidCreator
- java.lang.Object
-
- com.github.f4b6a3.uuid.creator.AbstractUuidCreator
-
- com.github.f4b6a3.uuid.creator.AbstractTimeBasedUuidCreator
-
- com.github.f4b6a3.uuid.creator.rfc4122.TimeBasedUuidCreator
-
- All Implemented Interfaces:
NoArgumentsUuidCreator
- Direct Known Subclasses:
DceSecurityUuidCreator
public class TimeBasedUuidCreator extends AbstractTimeBasedUuidCreator
Factory that creates time-based UUIDs. RFC-4122 version: 1.
-
-
Field Summary
-
Fields inherited from class com.github.f4b6a3.uuid.creator.AbstractTimeBasedUuidCreator
clockSequenceStrategy, nodeIdentifierStrategy, timestampStrategy
-
Fields inherited from class com.github.f4b6a3.uuid.creator.AbstractUuidCreator
version, versionBits
-
-
Constructor Summary
Constructors Modifier Constructor Description TimeBasedUuidCreator()protectedTimeBasedUuidCreator(UuidVersion version)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected longformatMostSignificantBits(long timestamp)Returns the timestamp bits of the UUID in the order defined in the RFC-4122. ### RFC-4122 - 4.2.2.-
Methods inherited from class com.github.f4b6a3.uuid.creator.AbstractTimeBasedUuidCreator
create, formatLeastSignificantBits, withClockSequence, withClockSequence, withClockSequenceStrategy, withMacNodeIdentifier, withNodeIdentifier, withNodeIdentifier, withNodeIdentifierStrategy, withoutOverrunException, withTimestampStrategy
-
Methods inherited from class com.github.f4b6a3.uuid.creator.AbstractUuidCreator
applyVariantBits, applyVersionBits, getVersion
-
-
-
-
Constructor Detail
-
TimeBasedUuidCreator
public TimeBasedUuidCreator()
-
TimeBasedUuidCreator
protected TimeBasedUuidCreator(UuidVersion version)
-
-
Method Detail
-
formatMostSignificantBits
protected long formatMostSignificantBits(long timestamp)
Returns the timestamp bits of the UUID in the order defined in the RFC-4122. ### RFC-4122 - 4.2.2. Generation Details Determine the values for the UTC-based timestamp and clock sequence to be used in the UUID, as described in Section 4.2.1. For the purposes of this algorithm, consider the timestamp to be a 60-bit unsigned integer and the clock sequence to be a 14-bit unsigned integer. Sequentially number the bits in a field, starting with zero for the least significant bit. "Set the time_low field equal to the least significant 32 bits (bits zero through 31) of the timestamp in the same order of significance. Set the time_mid field equal to bits 32 through 47 from the timestamp in the same order of significance. Set the 12 least significant bits (bits zero through 11) of the time_hi_and_version field equal to bits 48 through 59 from the timestamp in the same order of significance. Set the four most significant bits (bits 12 through 15) of the time_hi_and_version field to the 4-bit version number corresponding to the UUID version being created, as shown in the table above."- Specified by:
formatMostSignificantBitsin classAbstractTimeBasedUuidCreator- Parameters:
timestamp- a timestamp- Returns:
- the MSB
-
-