Package me.ahoo.cosid.snowflake
Class SnowflakeIdStateParser
java.lang.Object
me.ahoo.cosid.snowflake.SnowflakeIdStateParser
- Direct Known Subclasses:
MillisecondSnowflakeIdStateParser
,SecondSnowflakeIdStateParser
SnowflakeId State Parser.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionSnowflakeIdStateParser
(long epoch, int timestampBit, int machineBit, int sequenceBit) SnowflakeIdStateParser
(long epoch, int timestampBit, int machineBit, int sequenceBit, ZoneId zoneId) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract DateTimeFormatter
protected abstract long
getDiffTime
(LocalDateTime timestamp) protected abstract LocalDateTime
getTimestamp
(long diffTime) static SnowflakeIdStateParser
of
(SnowflakeId snowflakeId) static SnowflakeIdStateParser
of
(SnowflakeId snowflakeId, ZoneId zoneId) parse
(long id) int
parseMachineId
(long id) long
parseSequence
(long id) parseTimestamp
(long id)
-
Field Details
-
DELIMITER
- See Also:
-
zoneId
-
epoch
protected final long epoch -
sequenceBit
protected final int sequenceBit -
sequenceMask
protected final long sequenceMask -
machineBit
protected final int machineBit -
machineMask
protected final long machineMask -
machineLeft
protected final int machineLeft -
timestampBit
protected final int timestampBit -
timestampMask
protected final long timestampMask -
timestampLeft
protected final int timestampLeft
-
-
Constructor Details
-
SnowflakeIdStateParser
public SnowflakeIdStateParser(long epoch, int timestampBit, int machineBit, int sequenceBit) -
SnowflakeIdStateParser
public SnowflakeIdStateParser(long epoch, int timestampBit, int machineBit, int sequenceBit, ZoneId zoneId)
-
-
Method Details
-
getZoneId
-
getDateTimeFormatter
-
getTimestamp
-
getDiffTime
-
parse
-
parse
-
parseTimestamp
-
parseMachineId
public int parseMachineId(long id) -
parseSequence
public long parseSequence(long id) -
of
-
of
-