Class LazyIdGenerator

java.lang.Object
me.ahoo.cosid.provider.LazyIdGenerator
All Implemented Interfaces:
Decorator<IdGenerator>, IdGenerator, IdGeneratorDecorator, Statistical, StringIdGenerator

public final class LazyIdGenerator extends Object implements IdGeneratorDecorator
Lazy loading IdGenerator.
  • Constructor Details

    • LazyIdGenerator

      public LazyIdGenerator(String generatorName)
    • LazyIdGenerator

      public LazyIdGenerator(String generatorName, IdGeneratorProvider idGeneratorProvider)
  • Method Details

    • getGeneratorName

      public String getGeneratorName()
    • tryGet

      public IdGenerator tryGet(boolean required)
    • asSnowflakeId

      public SnowflakeId asSnowflakeId(boolean required)
    • asFriendlyId

      public SnowflakeFriendlyId asFriendlyId(boolean required)
    • asSegmentId

      public SegmentId asSegmentId(boolean required)
    • getActual

      @Nonnull public IdGenerator getActual()
      Description copied from interface: IdGeneratorDecorator
      Get the actual (wrapped) ID generator that this decorator is enhancing.

      This method returns the underlying ID generator that this decorator is wrapping. All ID generation requests are typically delegated to this actual generator, with the decorator adding its additional functionality.

      Specified by:
      getActual in interface Decorator<IdGenerator>
      Specified by:
      getActual in interface IdGeneratorDecorator
      Returns:
      The actual ID generator being decorated
    • idConverter

      @Nonnull public IdConverter idConverter()
      Description copied from interface: IdGenerator
      Get the ID converter used to convert long type IDs to String.

      By default, this returns Radix62IdConverter.PAD_START which converts long IDs to radix-62 string representations with padding to ensure consistent string lengths.

      Specified by:
      idConverter in interface IdGenerator
      Returns:
      ID converter for transforming numeric IDs to string format