Class IdConverterDefinition

java.lang.Object
me.ahoo.cosid.spring.boot.starter.IdConverterDefinition

public class IdConverterDefinition extends Object
Configuration definition for ID converters in CosId.

This class defines how IDs should be converted between their internal representation and external string formats. It supports various conversion types including radix conversion, friendly formatting, and custom converters.

Supported converter types:

  • TO_STRING - Simple string conversion
  • SNOWFLAKE_FRIENDLY - Human-readable snowflake ID format
  • RADIX - Base62 radix conversion
  • RADIX36 - Base36 radix conversion
  • CUSTOM - Custom converter implementation

The configuration also supports prefixes, suffixes, and grouping options to customize the final ID format.

  • Constructor Details

    • IdConverterDefinition

      public IdConverterDefinition()
  • Method Details

    • getType

      public IdConverterDefinition.Type getType()
      Gets the converter type.
      Returns:
      the converter type
    • setType

      public void setType(IdConverterDefinition.Type type)
      Sets the converter type.
      Parameters:
      type - the converter type to set
    • getPrefix

      public String getPrefix()
      Gets the static prefix.
      Returns:
      the prefix string, or null if not set
    • setPrefix

      public void setPrefix(String prefix)
      Sets the static prefix.
      Parameters:
      prefix - the prefix to set
    • getGroupPrefix

      public IdConverterDefinition.GroupPrefix getGroupPrefix()
      Gets the group prefix configuration.
      Returns:
      the group prefix configuration
    • setGroupPrefix

      public void setGroupPrefix(IdConverterDefinition.GroupPrefix groupPrefix)
      Sets the group prefix configuration.
      Parameters:
      groupPrefix - the group prefix configuration to set
    • getSuffix

      public String getSuffix()
      Gets the static suffix.
      Returns:
      the suffix string, or null if not set
    • setSuffix

      public void setSuffix(String suffix)
      Sets the static suffix.
      Parameters:
      suffix - the suffix to set
    • getRadix

      public IdConverterDefinition.Radix getRadix()
      Gets the radix62 configuration.
      Returns:
      the radix configuration
    • setRadix

      public void setRadix(IdConverterDefinition.Radix radix)
      Sets the radix62 configuration.
      Parameters:
      radix - the radix configuration to set
    • getRadix36

      public IdConverterDefinition.Radix36 getRadix36()
      Gets the radix36 configuration.
      Returns:
      the radix36 configuration
    • setRadix36

      public void setRadix36(IdConverterDefinition.Radix36 radix36)
      Sets the radix36 configuration.
      Parameters:
      radix36 - the radix36 configuration to set
    • getToString

      public IdConverterDefinition.ToString getToString()
      Gets the toString configuration.
      Returns:
      the toString configuration, or null if not set
    • setToString

      public void setToString(IdConverterDefinition.ToString toString)
      Sets the toString configuration.
      Parameters:
      toString - the toString configuration to set
    • getCustom

      public IdConverterDefinition.Custom getCustom()
      Gets the custom converter configuration.
      Returns:
      the custom configuration, or null if not set
    • setCustom

      public void setCustom(IdConverterDefinition.Custom custom)
      Sets the custom converter configuration.
      Parameters:
      custom - the custom configuration to set
    • getDatePrefix

      public IdConverterDefinition.DatePrefix getDatePrefix()
      Gets the date prefix configuration.
      Returns:
      the date prefix configuration
    • setDatePrefix

      public void setDatePrefix(IdConverterDefinition.DatePrefix datePrefix)
      Sets the date prefix configuration.
      Parameters:
      datePrefix - the date prefix configuration to set
    • getFriendly

      public IdConverterDefinition.Friendly getFriendly()
      Gets the friendly format configuration.
      Returns:
      the friendly configuration
    • setFriendly

      public void setFriendly(IdConverterDefinition.Friendly friendly)
      Sets the friendly format configuration.
      Parameters:
      friendly - the friendly configuration to set