Class DatePrefixIdConverter

java.lang.Object
me.ahoo.cosid.converter.DatePrefixIdConverter
All Implemented Interfaces:
Decorator<IdConverter>, IdConverter, Statistical

public class DatePrefixIdConverter extends Object implements IdConverter, Decorator<IdConverter>
  • Constructor Details

  • Method Details

    • asString

      @Nonnull public String asString(long id)
      Description copied from interface: IdConverter
      Convert a long type ID to its String representation.

      This method transforms a numeric ID into a string format according to the specific conversion algorithm implemented by the converter. For example, a radix converter might convert the number 12345 to "3d7".

      Specified by:
      asString in interface IdConverter
      Parameters:
      id - The long type ID to convert
      Returns:
      The String representation of the ID
    • asLong

      public long asLong(@Nonnull String idString)
      Description copied from interface: IdConverter
      Convert a String type ID back to its long representation.

      This method performs the reverse operation of IdConverter.asString(long), transforming a string ID back into its original numeric form. Implementations should be able to correctly parse strings generated by their IdConverter.asString(long) method.

      Specified by:
      asLong in interface IdConverter
      Parameters:
      idString - The String type ID to convert
      Returns:
      The long representation of the ID
    • getActual

      @Nonnull public IdConverter getActual()
      Description copied from interface: Decorator
      Get the actual (wrapped) object that this decorator is enhancing.

      This method returns the underlying object that this decorator is wrapping. For ID generators, this would typically be the base generator that is being enhanced with additional functionality.

      Specified by:
      getActual in interface Decorator<IdConverter>
      Returns:
      The actual object being decorated
    • stat

      public Stat stat()
      Description copied from interface: IdConverter
      Get statistical information about this converter.

      This method provides basic statistical information about the converter, including its implementation class name.

      Specified by:
      stat in interface IdConverter
      Specified by:
      stat in interface Statistical
      Returns:
      Statistical information about this converter