Record Class TtsIdPlus

java.lang.Object
java.lang.Record
uno.xifan.id.generator.distributed.ttsid.TtsIdPlus
All Implemented Interfaces:
Id

public record TtsIdPlus(long timestamp, int threadId, short sequence) extends Record implements Id
  • Constructor Details

    • TtsIdPlus

      public TtsIdPlus(long timestamp, int threadId, short sequence)
      Creates an instance of a TtsIdPlus record class.
      Parameters:
      timestamp - the value for the timestamp record component
      threadId - the value for the threadId record component
      sequence - the value for the sequence record component
  • Method Details

    • currentTimestamp

      public static long currentTimestamp()
    • toBytes

      public byte[] toBytes()
      Specified by:
      toBytes in interface Id
    • toLong

      public long toLong()
      Specified by:
      toLong in interface Id
    • toBase32

      public String toBase32()
      专门为80bit优化的算法
      Specified by:
      toBase32 in interface Id
    • toBase16

      public String toBase16()
      Specified by:
      toBase16 in interface Id
    • toString

      public final 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 interface Id
      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 '=='.
      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.
    • timestamp

      public long timestamp()
      Returns the value of the timestamp record component.
      Returns:
      the value of the timestamp record component
    • threadId

      public int threadId()
      Returns the value of the threadId record component.
      Returns:
      the value of the threadId record component
    • sequence

      public short sequence()
      Returns the value of the sequence record component.
      Returns:
      the value of the sequence record component