Class MinLengthShortCodeServiceImpl
java.lang.Object
icu.easyj.core.util.shortcode.impls.DefaultShortCodeServiceImpl
icu.easyj.core.util.shortcode.impls.MinLengthShortCodeServiceImpl
- All Implemented Interfaces:
IShortCodeService
@LoadLevel(name="min-length",
order=100)
public class MinLengthShortCodeServiceImpl
extends DefaultShortCodeServiceImpl
long型ID 与 短字符串 互相转换服务
基于默认实现的基础上,添加最小长度的功能
基于默认实现的基础上,添加最小长度的功能
- Author:
- wangliang181230
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final char[]默认的自定义进制(不含分隔字符DEFAULT_SEPARATOR)static final int默认的短字符串最小长度static final char默认的分隔字符(不能与DEFAULT_CHAR_TABLE中的字符重复)Fields inherited from class icu.easyj.core.util.shortcode.impls.DefaultShortCodeServiceImpl
charTable, firstChar -
Constructor Summary
ConstructorsConstructorDescriptionMinLengthShortCodeServiceImpl(char[] charTable, char separator) MinLengthShortCodeServiceImpl(char[] charTable, char separator, int minLength) MinLengthShortCodeServiceImpl(char[] charTable, char separator, int minLength, boolean needCheckSeparator) 构造函数 -
Method Summary
-
Field Details
-
DEFAULT_CHAR_TABLE
public static final char[] DEFAULT_CHAR_TABLE默认的自定义进制(不含分隔字符DEFAULT_SEPARATOR)- See Also:
-
DEFAULT_SEPARATOR
public static final char DEFAULT_SEPARATOR默认的分隔字符(不能与DEFAULT_CHAR_TABLE中的字符重复)- See Also:
-
DEFAULT_MIN_LENGTH
public static final int DEFAULT_MIN_LENGTH默认的短字符串最小长度- See Also:
-
-
Constructor Details
-
MinLengthShortCodeServiceImpl
public MinLengthShortCodeServiceImpl(char[] charTable, char separator, int minLength, boolean needCheckSeparator) 构造函数- Parameters:
charTable- 字符集separator- 分隔字符minLength- 最小长度needCheckSeparator- 是否校验分隔符的有效性
-
MinLengthShortCodeServiceImpl
public MinLengthShortCodeServiceImpl(char[] charTable, char separator, int minLength) -
MinLengthShortCodeServiceImpl
public MinLengthShortCodeServiceImpl(char[] charTable, char separator) -
MinLengthShortCodeServiceImpl
public MinLengthShortCodeServiceImpl()
-
-
Method Details
-
toCode
Description copied from interface:IShortCodeServicelong型ID 转换为 短字符串- Specified by:
toCodein interfaceIShortCodeService- Overrides:
toCodein classDefaultShortCodeServiceImpl- Parameters:
id- ID(必须大于等于0)- Returns:
- 短字符串
-
toId
Description copied from interface:IShortCodeService短字符串 转换为 long长整形ID- Specified by:
toIdin interfaceIShortCodeService- Overrides:
toIdin classDefaultShortCodeServiceImpl- Parameters:
shortCode- 短字符串- Returns:
- 原ID
-