Class IdEntity

java.lang.Object
org.seppiko.snowflake.IdEntity

public class IdEntity extends Object
Snowflake ID entity
Author:
Leonard Woo
  • Constructor Details

    • IdEntity

      protected IdEntity(long timestamp, long datacenterId, long workerId, long sequence)
      Snowflake ID entity constructor.
      Parameters:
      timestamp - ID timestamp.
      datacenterId - data center ID.
      workerId - machine or process ID.
      sequence - sequence number.
  • Method Details

    • getTimestamp

      public long getTimestamp()
      Get Snowflake id timestamp or offset timestamp.
      Returns:
      Timestamp (millisecond).
    • getDatacenterId

      public long getDatacenterId()
      Returns:
      Data center number the process running on.
    • getWorkerId

      public long getWorkerId()
      Returns:
      Machine or process number.
    • getSequence

      public long getSequence()
      Returns:
      Sequence number.
    • toString

      public String toString()
      Overrides:
      toString in class Object
      Returns:
      Snowflake id entity string.