Package me.ahoo.cosid.snowflake
Interface SnowflakeFriendlyId
- All Superinterfaces:
IdGenerator,SnowflakeId,Statistical,StringIdGenerator
- All Known Implementing Classes:
DefaultSnowflakeFriendlyId
Snowflake ID with human-readable string representation.
Provides methods to convert Snowflake IDs to and from a friendly string format containing timestamp, machine ID, and sequence.
-
Field Summary
Fields inherited from interface me.ahoo.cosid.snowflake.SnowflakeId
TOTAL_BIT -
Method Summary
Modifier and TypeMethodDescriptiondefault @NonNull SnowflakeIdStateGenerates an ID and returns its friendly state.default @NonNull SnowflakeIdStatefriendlyId(long id) Parses a raw ID to friendly state.@NonNull SnowflakeIdStateParserGets the state parser.default @NonNull SnowflakeIdStateofFriendlyId(String friendlyId) Parses a friendly ID string to state.Methods inherited from interface me.ahoo.cosid.IdGenerator
generate, generateAsString, idConverterMethods inherited from interface me.ahoo.cosid.snowflake.SnowflakeId
getEpoch, getLastTimestamp, getMachineBit, getMachineId, getMaxMachineId, getMaxSequence, getMaxTimestamp, getSequenceBit, getTimestampBit, isSafeJavascript, stat
-
Method Details
-
getParser
@NonNull SnowflakeIdStateParser getParser()Gets the state parser.- Returns:
- the parser
-
friendlyId
Parses a raw ID to friendly state.- Parameters:
id- the raw ID- Returns:
- the friendly state
-
friendlyId
Generates an ID and returns its friendly state.- Returns:
- the friendly state
-
ofFriendlyId
Parses a friendly ID string to state.- Parameters:
friendlyId- the friendly ID string- Returns:
- the friendly state
-