Record Class UuidParser.ParsedUuid
java.lang.Object
java.lang.Record
cloud.opencode.base.id.uuid.UuidParser.ParsedUuid
- Record Components:
uuid- the original UUID | 原始UUIDversion- UUID version (1-8) | UUID版本(1-8)variant- UUID variant bits | UUID变体位timestamp- embedded timestamp for v1/v6/v7, null otherwise | v1/v6/v7的嵌入时间戳,否则为nulltimeOrdered- true for v1, v6, v7 (time-ordered) | v1、v6、v7为true(时间有序)
- Enclosing class:
UuidParser
public static record UuidParser.ParsedUuid(UUID uuid, int version, int variant, Instant timestamp, boolean timeOrdered)
extends Record
Structured result of parsing a UUID
UUID解析的结构化结果
- Since:
- JDK 25, opencode-base-id V1.0.3
- Author:
- Leon Soo www.LeonSoo.com
-
Constructor Summary
ConstructorsConstructorDescriptionParsedUuid(UUID uuid, int version, int variant, Instant timestamp, boolean timeOrdered) Creates an instance of aParsedUuidrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanisV4()Returns true if this is a UUID version 4 (random) 如果是UUID版本4(随机)则返回truebooleanisV7()Returns true if this is a UUID version 7 如果是UUID版本7则返回truebooleanReturns the value of thetimeOrderedrecord component.Returns the value of thetimestamprecord component.Returns the UUID as a 32-character string without hyphens 返回不含连字符的32字符UUID字符串toString()Returns a string representation of this record class.uuid()Returns the value of theuuidrecord component.intvariant()Returns the value of thevariantrecord component.intversion()Returns the value of theversionrecord component.
-
Constructor Details
-
ParsedUuid
Creates an instance of aParsedUuidrecord class.- Parameters:
uuid- the value for theuuidrecord componentversion- the value for theversionrecord componentvariant- the value for thevariantrecord componenttimestamp- the value for thetimestamprecord componenttimeOrdered- the value for thetimeOrderedrecord component
-
-
Method Details
-
toShortString
Returns the UUID as a 32-character string without hyphens 返回不含连字符的32字符UUID字符串- Returns:
- short UUID string | 短UUID字符串
-
isV7
public boolean isV7()Returns true if this is a UUID version 7 如果是UUID版本7则返回true- Returns:
- true for v7 | v7时返回true
-
isV4
public boolean isV4()Returns true if this is a UUID version 4 (random) 如果是UUID版本4(随机)则返回true- Returns:
- true for v4 | v4时返回true
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
uuid
-
version
-
variant
-
timestamp
-
timeOrdered
public boolean timeOrdered()Returns the value of thetimeOrderedrecord component.- Returns:
- the value of the
timeOrderedrecord component
-