Package me.ahoo.cosid

Interface IdGenerator

All Superinterfaces:
Statistical, StringIdGenerator
All Known Subinterfaces:
CosIdGenerator, IdGeneratorDecorator, SegmentId, SnowflakeFriendlyId, SnowflakeId
All Known Implementing Classes:
AbstractSnowflakeId, AtomicLongGenerator, ClockSyncCosIdGenerator, ClockSyncSnowflakeId, DefaultSegmentId, DefaultSnowflakeFriendlyId, LazyIdGenerator, MillisecondSnowflakeId, MockIdGenerator, Radix36CosIdGenerator, Radix62CosIdGenerator, RadixCosIdGenerator, SecondSnowflakeId, SegmentChainId, StringIdGeneratorDecorator, StringSegmentId, StringSnowflakeId, UncertaintyIdGenerator, UuidGenerator

@ThreadSafe public interface IdGenerator extends StringIdGenerator, Statistical
Id Generator.
  • Method Details

    • idConverter

      @Nonnull default IdConverter idConverter()
      ID converter, used to convert long type ID to String.
      Returns:
      ID converter
    • generate

      long generate()
      Generate distributed ID.
      Returns:
      generated distributed ID
    • generateAsString

      @Nonnull default String generateAsString()
      Description copied from interface: StringIdGenerator
      Generate string type distributed ID.
      Specified by:
      generateAsString in interface StringIdGenerator
      Returns:
      string type distributed ID
    • stat

      default IdGeneratorStat stat()
      Specified by:
      stat in interface Statistical