Record Class KsuidParser.ParsedKsuid

java.lang.Object
java.lang.Record
cloud.opencode.base.id.ksuid.KsuidParser.ParsedKsuid
Record Components:
ksuid - the original KSUID string | 原始KSUID字符串
bytes - the raw 20-byte representation | 原始20字节表示
time - the timestamp | 时间戳
payload - the 16-byte random payload | 16字节随机负载
Enclosing class:
KsuidParser

public static record KsuidParser.ParsedKsuid(String ksuid, byte[] bytes, Instant time, byte[] payload) extends Record
Parsed KSUID result 解析后的KSUID结果
Since:
JDK 25, opencode-base-id V1.1.0
Author:
Leon Soo www.LeonSoo.com
  • Constructor Summary

    Constructors
    Constructor
    Description
    ParsedKsuid(String ksuid, byte[] bytes, Instant time, byte[] payload)
    Compact canonical constructor that makes defensive copies of mutable byte arrays to prevent callers from mutating internal state.
  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    Returns a defensive copy of the raw bytes 返回原始字节的防御性副本
    final boolean
    Indicates whether some other object is "equal to" this one.
    Gets the payload as hex string 获取负载的十六进制字符串
    Gets the timestamp part as hex string 获取时间戳部分的十六进制字符串
    final int
    Returns a hash code value for this object.
    Returns the value of the ksuid record component.
    byte[]
    Returns a defensive copy of the payload 返回负载的防御性副本
    Returns the value of the time record component.
    Returns a string representation of this record class.

    Methods inherited from class Object

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

    • ParsedKsuid

      public ParsedKsuid(String ksuid, byte[] bytes, Instant time, byte[] payload)
      Compact canonical constructor that makes defensive copies of mutable byte arrays to prevent callers from mutating internal state. 紧凑规范构造函数,对可变字节数组进行防御性复制以防止调用者修改内部状态。
  • Method Details

    • bytes

      public byte[] bytes()
      Returns a defensive copy of the raw bytes 返回原始字节的防御性副本
      Returns:
      copy of bytes | 字节副本
    • payload

      public byte[] payload()
      Returns a defensive copy of the payload 返回负载的防御性副本
      Returns:
      copy of payload | 负载副本
    • getTimestampHex

      public String getTimestampHex()
      Gets the timestamp part as hex string 获取时间戳部分的十六进制字符串
      Returns:
      hex string | 十六进制字符串
    • getPayloadHex

      public String getPayloadHex()
      Gets the payload as hex string 获取负载的十六进制字符串
      Returns:
      hex string | 十六进制字符串
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • ksuid

      public String ksuid()
      Returns the value of the ksuid record component.
      Returns:
      the value of the ksuid record component
    • time

      public Instant time()
      Returns the value of the time record component.
      Returns:
      the value of the time record component