Package me.ahoo.cosid.stat.generator
Record Class SnowflakeIdStat
java.lang.Object
java.lang.Record
me.ahoo.cosid.stat.generator.SnowflakeIdStat
- All Implemented Interfaces:
IdGeneratorStat
,Stat
public record SnowflakeIdStat(String kind, long epoch, int timestampBit, int machineBit, int sequenceBit, boolean isSafeJavascript, int machineId, long lastTimestamp, Stat converter)
extends Record
implements IdGeneratorStat
-
Constructor Summary
ConstructorDescriptionSnowflakeIdStat
(String kind, long epoch, int timestampBit, int machineBit, int sequenceBit, boolean isSafeJavascript, int machineId, long lastTimestamp, Stat converter) Creates an instance of aSnowflakeIdStat
record class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theconverter
record component.long
epoch()
Returns the value of theepoch
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.boolean
Returns the value of theisSafeJavascript
record component.kind()
Returns the value of thekind
record component.long
Returns the value of thelastTimestamp
record component.int
Returns the value of themachineBit
record component.int
Returns the value of themachineId
record component.int
Returns the value of thesequenceBit
record component.int
Returns the value of thetimestampBit
record component.final String
toString()
Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface me.ahoo.cosid.stat.generator.IdGeneratorStat
actual
-
Constructor Details
-
SnowflakeIdStat
public SnowflakeIdStat(String kind, long epoch, int timestampBit, int machineBit, int sequenceBit, boolean isSafeJavascript, int machineId, long lastTimestamp, Stat converter) Creates an instance of aSnowflakeIdStat
record class.- Parameters:
kind
- the value for thekind
record componentepoch
- the value for theepoch
record componenttimestampBit
- the value for thetimestampBit
record componentmachineBit
- the value for themachineBit
record componentsequenceBit
- the value for thesequenceBit
record componentisSafeJavascript
- the value for theisSafeJavascript
record componentmachineId
- the value for themachineId
record componentlastTimestamp
- the value for thelastTimestamp
record componentconverter
- the value for theconverter
record component
-
-
Method Details
-
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. -
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. -
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 '=='. -
kind
Returns the value of thekind
record component. -
epoch
public long epoch()Returns the value of theepoch
record component.- Returns:
- the value of the
epoch
record component
-
timestampBit
public int timestampBit()Returns the value of thetimestampBit
record component.- Returns:
- the value of the
timestampBit
record component
-
machineBit
public int machineBit()Returns the value of themachineBit
record component.- Returns:
- the value of the
machineBit
record component
-
sequenceBit
public int sequenceBit()Returns the value of thesequenceBit
record component.- Returns:
- the value of the
sequenceBit
record component
-
isSafeJavascript
public boolean isSafeJavascript()Returns the value of theisSafeJavascript
record component.- Returns:
- the value of the
isSafeJavascript
record component
-
machineId
public int machineId()Returns the value of themachineId
record component.- Returns:
- the value of the
machineId
record component
-
lastTimestamp
public long lastTimestamp()Returns the value of thelastTimestamp
record component.- Returns:
- the value of the
lastTimestamp
record component
-
converter
Returns the value of theconverter
record component.- Specified by:
converter
in interfaceIdGeneratorStat
- Returns:
- the value of the
converter
record component
-