Record Class UuidParser.ParsedUuid

java.lang.Object
java.lang.Record
cloud.opencode.base.id.uuid.UuidParser.ParsedUuid
Record Components:
uuid - the original UUID | 原始UUID
version - UUID version (1-8) | UUID版本(1-8)
variant - UUID variant bits | UUID变体位
timestamp - embedded timestamp for v1/v6/v7, null otherwise | v1/v6/v7的嵌入时间戳,否则为null
timeOrdered - 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

    Constructors
    Constructor
    Description
    ParsedUuid(UUID uuid, int version, int variant, Instant timestamp, boolean timeOrdered)
    Creates an instance of a ParsedUuid record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    boolean
    Returns true if this is a UUID version 4 (random) 如果是UUID版本4(随机)则返回true
    boolean
    Returns true if this is a UUID version 7 如果是UUID版本7则返回true
    boolean
    Returns the value of the timeOrdered record component.
    Returns the value of the timestamp record component.
    Returns the UUID as a 32-character string without hyphens 返回不含连字符的32字符UUID字符串
    Returns a string representation of this record class.
    Returns the value of the uuid record component.
    int
    Returns the value of the variant record component.
    int
    Returns the value of the version record component.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ParsedUuid

      public ParsedUuid(UUID uuid, int version, int variant, Instant timestamp, boolean timeOrdered)
      Creates an instance of a ParsedUuid record class.
      Parameters:
      uuid - the value for the uuid record component
      version - the value for the version record component
      variant - the value for the variant record component
      timestamp - the value for the timestamp record component
      timeOrdered - the value for the timeOrdered record component
  • Method Details

    • toShortString

      public String 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

      public String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • uuid

      public UUID uuid()
      Returns the value of the uuid record component.
      Returns:
      the value of the uuid record component
    • version

      public int version()
      Returns the value of the version record component.
      Returns:
      the value of the version record component
    • variant

      public int variant()
      Returns the value of the variant record component.
      Returns:
      the value of the variant record component
    • timestamp

      public Instant timestamp()
      Returns the value of the timestamp record component.
      Returns:
      the value of the timestamp record component
    • timeOrdered

      public boolean timeOrdered()
      Returns the value of the timeOrdered record component.
      Returns:
      the value of the timeOrdered record component