Interface IShortCodeService

All Known Implementing Classes:
DefaultShortCodeServiceImpl, MinIdShortCodeServiceImpl, MinLengthShortCodeServiceImpl

public interface IShortCodeService
long型ID 与 短字符串 互相转换的服务类

用途:邀请码、短链接码、...等等

Author:
wangliang181230
  • Method Summary

    Modifier and Type
    Method
    Description
    long型ID 转换为 短字符串
    long
    toId(String shortCode)
    短字符串 转换为 long长整形ID
  • Method Details

    • toCode

      @NonNull String toCode(@NonNull Long id)
      long型ID 转换为 短字符串
      Parameters:
      id - ID(必须大于等于0)
      Returns:
      短字符串
      Throws:
      IllegalArgumentException - ID为null 或 ID小于0
    • toId

      long toId(@NonNull String shortCode)
      短字符串 转换为 long长整形ID
      Parameters:
      shortCode - 短字符串
      Returns:
      原ID
      Throws:
      IllegalArgumentException - shortCode为null