Package me.ahoo.cosid

Interface StringIdGenerator

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

@ThreadSafe public interface StringIdGenerator
String type ID generator.

This interface defines the contract for generating distributed IDs in string format. It is typically used when string IDs are preferred over numeric IDs, such as for database primary keys that need to be URL-safe or human-readable.

Implementations of this interface are expected to be thread-safe and can be used concurrently across multiple threads.

  • Method Summary

    Modifier and Type
    Method
    Description
    Generate a distributed ID as a string value.
  • Method Details

    • generateAsString

      @Nonnull String generateAsString()
      Generate a distributed ID as a string value.

      This method generates a unique string identifier that is guaranteed to be unique within the distributed system. The format and structure of the string ID depends on the specific implementation.

      Returns:
      A unique distributed ID as a string value