diff --git a/CHANGELOG.md b/CHANGELOG.md index a58e9a9e4..8b1226517 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ * 【core 】 增加FastStringWriter * 【core 】 增加NumberUtil.ceilDiv方法(pr#858@Github) * 【core 】 IdcardUtil增加省份校验(issue#859@Github) +* 【extra 】 TemplateFactory和TokenizerFactory增加单例的get方法 ### Bug修复 * 【core 】 修复URLBuilder中请求参数有`&`导致的问题(issue#850@Github) diff --git a/hutool-core/src/main/java/cn/hutool/core/lang/Singleton.java b/hutool-core/src/main/java/cn/hutool/core/lang/Singleton.java index c58d3b4d2..96ab8616f 100644 --- a/hutool-core/src/main/java/cn/hutool/core/lang/Singleton.java +++ b/hutool-core/src/main/java/cn/hutool/core/lang/Singleton.java @@ -1,5 +1,6 @@ package cn.hutool.core.lang; +import cn.hutool.core.lang.func.Func0; import cn.hutool.core.util.ArrayUtil; import cn.hutool.core.util.ClassUtil; import cn.hutool.core.util.ReflectUtil; @@ -30,11 +31,26 @@ public final class Singleton { * @param params 构造方法参数 * @return 单例对象 */ - @SuppressWarnings("unchecked") public static T get(Class clazz, Object... params) { Assert.notNull(clazz, "Class must be not null !"); final String key = buildKey(clazz.getName(), params); - return (T) POOL.get(key, () -> ReflectUtil.newInstance(clazz, params)); + return get(key, () -> ReflectUtil.newInstance(clazz, params)); + } + + /** + * 获得指定类的单例对象
+ * 对象存在于池中返回,否则创建,每次调用此方法获得的对象为同一个对象
+ * 注意:单例针对的是类和对象,因此get方法第一次调用时创建的对象始终唯一,也就是说就算参数变更,返回的依旧是第一次创建的对象 + * + * @param 单例对象类型 + * @param key 自定义键 + * @param supplier 单例对象的创建函数 + * @return 单例对象 + * @since 5.3.3 + */ + @SuppressWarnings("unchecked") + public static T get(String key, Func0 supplier) { + return (T) POOL.get(key, supplier::call); } /** @@ -60,7 +76,18 @@ public final class Singleton { */ public static void put(Object obj) { Assert.notNull(obj, "Bean object must be not null !"); - POOL.put(obj.getClass().getName(), obj); + put(obj.getClass().getName(), obj); + } + + /** + * 将已有对象放入单例中,其Class做为键 + * + * @param key 键 + * @param obj 对象 + * @since 5.3.3 + */ + public static void put(String key, Object obj) { + POOL.put(key, obj); } /** @@ -70,10 +97,19 @@ public final class Singleton { */ public static void remove(Class clazz) { if (null != clazz) { - POOL.remove(clazz.getName()); + remove(clazz.getName()); } } + /** + * 移除指定Singleton对象 + * + * @param key 键 + */ + public static void remove(String key) { + POOL.remove(key); + } + /** * 清除所有Singleton对象 */ diff --git a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java b/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java index 1c011f6f7..4be5ea355 100644 --- a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java +++ b/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java @@ -838,6 +838,27 @@ public class ArrayUtil { return list.toArray(Arrays.copyOf(array, list.size())); } + /** + * 编辑数组
+ * 编辑过程通过传入的Editor实现来返回需要的元素内容,这个Editor实现可以实现以下功能: + * + *
+	 * 1、修改元素对象,返回集合中为修改后的对象
+	 * 
+ * + * 注意:此方法会修改原数组! + * + * @param 数组元素类型 + * @param array 数组 + * @param editor 编辑器接口 + * @since 5.3.3 + */ + public static void edit(T[] array, Editor editor) { + for(int i = 0; i < array.length; i++){ + array[i] = editor.edit(array[i]); + } + } + /** * 过滤
* 过滤过程通过传入的Filter实现来过滤返回需要的元素内容,这个Filter实现可以实现以下功能: @@ -2412,6 +2433,39 @@ public class ArrayUtil { return sb.toString(); } + /** + * 以 conjunction 为分隔符将数组转换为字符串 + * + * @param 被处理的集合 + * @param array 数组 + * @param conjunction 分隔符 + * @param editor 每个元素的编辑器,null表示不编辑 + * @return 连接后的字符串 + * @since 5.3.3 + */ + public static String join(T[] array, CharSequence conjunction, Editor editor) { + if (null == array) { + return null; + } + + final StringBuilder sb = new StringBuilder(); + boolean isFirst = true; + for (T item : array) { + if (isFirst) { + isFirst = false; + } else { + sb.append(conjunction); + } + if(null != editor){ + item = editor.edit(item); + } + if(null != item){ + sb.append(StrUtil.toString(item)); + } + } + return sb.toString(); + } + /** * 以 conjunction 为分隔符将数组转换为字符串 * diff --git a/hutool-extra/pom.xml b/hutool-extra/pom.xml index d368455aa..8ff91aa0a 100644 --- a/hutool-extra/pom.xml +++ b/hutool-extra/pom.xml @@ -220,6 +220,18 @@ 2.0.3.RELEASE true + + com.belerweb + pinyin4j + 2.5.1 + true + + + com.github.stuxuhai + jpinyin + 1.1.8 + true + org.springframework.boot spring-boot-starter-test diff --git a/hutool-extra/src/main/java/cn/hutool/extra/pinyin/PinyinEngine.java b/hutool-extra/src/main/java/cn/hutool/extra/pinyin/PinyinEngine.java new file mode 100644 index 000000000..6df9a8446 --- /dev/null +++ b/hutool-extra/src/main/java/cn/hutool/extra/pinyin/PinyinEngine.java @@ -0,0 +1,53 @@ +package cn.hutool.extra.pinyin; + +import cn.hutool.core.util.ArrayUtil; +import cn.hutool.core.util.StrUtil; + +/** + * 拼音引擎接口,具体的拼音实现通过实现此接口,完成具体实现功能 + * + * @author looly + * @since 5.3.3 + */ +public interface PinyinEngine { + + /** + * 如果c为汉字,则返回大写拼音;如果c不是汉字,则返回String.valueOf(c) + * + * @param c 任意字符,汉字返回拼音,非汉字原样返回 + * @return 汉字返回拼音,非汉字原样返回 + */ + String getPinyin(char c); + + /** + * 获取字符串对应的完整拼音,非中文返回原字符 + * + * @param str 字符串 + * @param separator 拼音之间的分隔符 + * @return 拼音 + */ + String getPinyin(String str, String separator); + + /** + * 将输入字符串转为拼音首字母,其它字符原样返回 + * + * @param c 任意字符,汉字返回拼音,非汉字原样返回 + * @return 汉字返回拼音,非汉字原样返回 + */ + default char getFirstLetter(char c) { + return getPinyin(c).charAt(0); + } + + /** + * 将输入字符串转为拼音首字母,其它字符原样返回 + * + * @param str 任意字符,汉字返回拼音,非汉字原样返回 + * @param separator 分隔符 + * @return 汉字返回拼音,非汉字原样返回 + */ + default String getFirstLetter(String str, String separator) { + final String splitSeparator = StrUtil.isEmpty(separator) ? "#" : separator; + final String[] split = StrUtil.split(getPinyin(str, splitSeparator), splitSeparator); + return ArrayUtil.join(split, separator, (s)->String.valueOf(s.charAt(0))); + } +} diff --git a/hutool-extra/src/main/java/cn/hutool/extra/pinyin/PinyinException.java b/hutool-extra/src/main/java/cn/hutool/extra/pinyin/PinyinException.java new file mode 100644 index 000000000..ff1f5063c --- /dev/null +++ b/hutool-extra/src/main/java/cn/hutool/extra/pinyin/PinyinException.java @@ -0,0 +1,33 @@ +package cn.hutool.extra.pinyin; + +import cn.hutool.core.exceptions.ExceptionUtil; +import cn.hutool.core.util.StrUtil; + +/** + * 模板异常 + * + * @author xiaoleilu + */ +public class PinyinException extends RuntimeException { + private static final long serialVersionUID = 1L; + + public PinyinException(Throwable e) { + super(ExceptionUtil.getMessage(e), e); + } + + public PinyinException(String message) { + super(message); + } + + public PinyinException(String messageTemplate, Object... params) { + super(StrUtil.format(messageTemplate, params)); + } + + public PinyinException(String message, Throwable throwable) { + super(message, throwable); + } + + public PinyinException(Throwable throwable, String messageTemplate, Object... params) { + super(StrUtil.format(messageTemplate, params), throwable); + } +} diff --git a/hutool-extra/src/main/java/cn/hutool/extra/pinyin/PinyinUtil.java b/hutool-extra/src/main/java/cn/hutool/extra/pinyin/PinyinUtil.java index 5e394e6fa..9e59bdc45 100644 --- a/hutool-extra/src/main/java/cn/hutool/extra/pinyin/PinyinUtil.java +++ b/hutool-extra/src/main/java/cn/hutool/extra/pinyin/PinyinUtil.java @@ -1,87 +1,85 @@ package cn.hutool.extra.pinyin; -import com.github.promeg.pinyinhelper.Pinyin; +import cn.hutool.core.util.StrUtil; +import cn.hutool.extra.pinyin.engine.PinyinFactory; /** - * 拼音工具类,封装了TinyPinyin - * - *

- * TinyPinyin(https://github.com/promeG/TinyPinyin)提供者未提交Maven中央库,
- * 因此使用 - * https://github.com/biezhi/TinyPinyin打包的版本 - *

- * - *

- * 引入: - *

- * <dependency>
- *     <groupId>io.github.biezhi</groupId>
- *     <artifactId>TinyPinyin</artifactId>
- *     <version>2.0.3.RELEASE</version>
- * </dependency>
- * 
+ * 拼音工具类,封装了TinyPinyin、JPinyin、Pinyin4j,通过SPI自动识别。 * * @author looly */ public class PinyinUtil { + private static final String CHINESE_REGEX = "[\\u4e00-\\u9fa5]"; + /** - * 自定义拼音全局配置,例如加入自定义字典等 + * 获得全局单例的拼音引擎 * - * @param config 配置,通过Pinyin.newConfig().with(dict)添加字典 + * @return 全局单例的拼音引擎 */ - public static void init(Pinyin.Config config) { - Pinyin.init(config); + public static PinyinEngine getEngine(){ + return PinyinFactory.get(); } /** * 如果c为汉字,则返回大写拼音;如果c不是汉字,则返回String.valueOf(c) * - * @param c 任意字符,汉字返回拼音,非汉字原样返回 - * @param isToUpperCase 是否转换为大写 + * @param c 任意字符,汉字返回拼音,非汉字原样返回 * @return 汉字返回拼音,非汉字原样返回 */ - public static String getPinyin(char c, boolean isToUpperCase) { - final String pinyin = Pinyin.toPinyin(c); - return isToUpperCase ? pinyin : pinyin.toLowerCase(); + public static String getPinyin(char c) { + return getEngine().getPinyin(c); } /** * 将输入字符串转为拼音,每个字之间的拼音使用空格分隔 * - * @param str 任意字符,汉字返回拼音,非汉字原样返回 - * @param isToUpperCase 是否转换为大写 + * @param str 任意字符,汉字返回拼音,非汉字原样返回 * @return 汉字返回拼音,非汉字原样返回 */ - public static String getPinyin(String str, boolean isToUpperCase) { - return getPinyin(str, " ", isToUpperCase); + public static String getPinyin(String str) { + return getPinyin(str, StrUtil.SPACE); } /** * 将输入字符串转为拼音,以字符为单位插入分隔符 * - * @param str 任意字符,汉字返回拼音,非汉字原样返回 - * @param separator 每个字拼音之间的分隔符 - * @param isToUpperCase 是否转换为大写 + * @param str 任意字符,汉字返回拼音,非汉字原样返回 + * @param separator 每个字拼音之间的分隔符 * @return 汉字返回拼音,非汉字原样返回 */ - public static String getPinyin(String str, String separator, boolean isToUpperCase) { - final String pinyin = Pinyin.toPinyin(str, separator); - return isToUpperCase ? pinyin : pinyin.toLowerCase(); + public static String getPinyin(String str, String separator) { + return getEngine().getPinyin(str, separator); } /** * 将输入字符串转为拼音首字母,其它字符原样返回 * - * @param str 任意字符,汉字返回拼音,非汉字原样返回 - * @param isToUpperCase 是否转换为大写 + * @param c 任意字符,汉字返回拼音,非汉字原样返回 * @return 汉字返回拼音,非汉字原样返回 */ - public static char[] getFirstLetter(String str, boolean isToUpperCase) { - final char[] result = new char[str.length()]; - for(int i=0; i < result.length; i++){ - result[i] = getPinyin(str.charAt(i), isToUpperCase).charAt(0); - } - return result; + public static char getFirstLetter(char c) { + return getEngine().getFirstLetter(c); + } + + /** + * 将输入字符串转为拼音首字母,其它字符原样返回 + * + * @param str 任意字符,汉字返回拼音,非汉字原样返回 + * @param separator 分隔符 + * @return 汉字返回拼音,非汉字原样返回 + */ + public static String getFirstLetter(String str, String separator) { + return getEngine().getFirstLetter(str, separator); + } + + /** + * 是否为中文字符 + * + * @param c 字符 + * @return 是否为中文字符 + */ + public static boolean isChinese(char c) { + return '〇' == c || String.valueOf(c).matches(CHINESE_REGEX); } } diff --git a/hutool-extra/src/main/java/cn/hutool/extra/pinyin/engine/PinyinFactory.java b/hutool-extra/src/main/java/cn/hutool/extra/pinyin/engine/PinyinFactory.java new file mode 100644 index 000000000..09d2228ba --- /dev/null +++ b/hutool-extra/src/main/java/cn/hutool/extra/pinyin/engine/PinyinFactory.java @@ -0,0 +1,52 @@ +package cn.hutool.extra.pinyin.engine; + +import cn.hutool.core.lang.Singleton; +import cn.hutool.core.util.ServiceLoaderUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.extra.pinyin.PinyinEngine; +import cn.hutool.extra.template.TemplateException; +import cn.hutool.log.StaticLog; + +/** + * 简单拼音引擎工厂,用于根据用户引入的拼音库jar,自动创建对应的拼音引擎对象 + * + * @author looly + */ +public class PinyinFactory { + + /** + * 获得单例的PinyinEngine + * + * @return 单例的PinyinEngine + */ + public static PinyinEngine get(){ + return Singleton.get(PinyinEngine.class.getName(), PinyinFactory::create); + } + + /** + * 根据用户引入的拼音引擎jar,自动创建对应的拼音引擎对象
+ * 推荐创建的引擎单例使用,此方法每次调用会返回新的引擎 + * + * @return {@link PinyinEngine} + */ + public static PinyinEngine create() { + final PinyinEngine engine = doCreate(); + StaticLog.debug("Use [{}] Engine As Default.", StrUtil.removeSuffix(engine.getClass().getSimpleName(), "Engine")); + return engine; + } + + /** + * 根据用户引入的拼音引擎jar,自动创建对应的拼音引擎对象
+ * 推荐创建的引擎单例使用,此方法每次调用会返回新的引擎 + * + * @return {@link PinyinEngine} + */ + private static PinyinEngine doCreate() { + final PinyinEngine engine = ServiceLoaderUtil.loadFirstAvailable(PinyinEngine.class); + if(null != engine){ + return engine; + } + + throw new TemplateException("No template found ! Please add one of pinyin jar to your project !"); + } +} diff --git a/hutool-extra/src/main/java/cn/hutool/extra/pinyin/engine/jpinyin/JPinyinEngine.java b/hutool-extra/src/main/java/cn/hutool/extra/pinyin/engine/jpinyin/JPinyinEngine.java new file mode 100644 index 000000000..d17cfc1d0 --- /dev/null +++ b/hutool-extra/src/main/java/cn/hutool/extra/pinyin/engine/jpinyin/JPinyinEngine.java @@ -0,0 +1,64 @@ +package cn.hutool.extra.pinyin.engine.jpinyin; + +import cn.hutool.core.util.ArrayUtil; +import cn.hutool.extra.pinyin.PinyinEngine; +import com.github.stuxuhai.jpinyin.PinyinException; +import com.github.stuxuhai.jpinyin.PinyinFormat; +import com.github.stuxuhai.jpinyin.PinyinHelper; + +/** + * 封装了Jpinyin的引擎。 + * + *

+ * jpinyin(github库作者已删除)封装。 + *

+ * + *

+ * 引入: + *

+ * <dependency>
+ *     <groupId>com.github.stuxuhai</groupId>
+ *     <artifactId>jpinyin</artifactId>
+ *     <version>1.1.8</version>
+ * </dependency>
+ * 
+ * + * @author looly + */ +public class JPinyinEngine implements PinyinEngine { + + //设置汉子拼音输出的格式 + PinyinFormat format; + + public JPinyinEngine(){ + this(null); + } + + public JPinyinEngine(PinyinFormat format){ + init(format); + } + + public void init(PinyinFormat format){ + if(null == format){ + // 不加声调 + format = PinyinFormat.WITHOUT_TONE; + } + this.format = format; + } + + + @Override + public String getPinyin(char c) { + String[] results = PinyinHelper.convertToPinyinArray(c, format); + return ArrayUtil.isEmpty(results) ? String.valueOf(c) : results[0]; + } + + @Override + public String getPinyin(String str, String separator) { + try { + return PinyinHelper.convertToPinyinString(str, separator, format); + } catch (PinyinException e) { + throw new cn.hutool.extra.pinyin.PinyinException(e); + } + } +} diff --git a/hutool-extra/src/main/java/cn/hutool/extra/pinyin/engine/jpinyin/package-info.java b/hutool-extra/src/main/java/cn/hutool/extra/pinyin/engine/jpinyin/package-info.java new file mode 100644 index 000000000..308bffd4c --- /dev/null +++ b/hutool-extra/src/main/java/cn/hutool/extra/pinyin/engine/jpinyin/package-info.java @@ -0,0 +1,20 @@ +/** + * 封装了Jpinyin的引擎。 + * + *

+ * jpinyin(github库作者已删除)封装。 + *

+ * + *

+ * 引入: + *

+ * <dependency>
+ *     <groupId>com.github.stuxuhai</groupId>
+ *     <artifactId>jpinyin</artifactId>
+ *     <version>1.1.8</version>
+ * </dependency>
+ * 
+ * + * @author looly + */ +package cn.hutool.extra.pinyin.engine.jpinyin; \ No newline at end of file diff --git a/hutool-extra/src/main/java/cn/hutool/extra/pinyin/engine/package-info.java b/hutool-extra/src/main/java/cn/hutool/extra/pinyin/engine/package-info.java new file mode 100644 index 000000000..e87d6e71a --- /dev/null +++ b/hutool-extra/src/main/java/cn/hutool/extra/pinyin/engine/package-info.java @@ -0,0 +1,7 @@ +/** + * 拼音具体实现 + * + * @author looly + * + */ +package cn.hutool.extra.pinyin.engine; \ No newline at end of file diff --git a/hutool-extra/src/main/java/cn/hutool/extra/pinyin/engine/pinyin4j/Pinyin4jEngine.java b/hutool-extra/src/main/java/cn/hutool/extra/pinyin/engine/pinyin4j/Pinyin4jEngine.java new file mode 100644 index 000000000..3de08d659 --- /dev/null +++ b/hutool-extra/src/main/java/cn/hutool/extra/pinyin/engine/pinyin4j/Pinyin4jEngine.java @@ -0,0 +1,92 @@ +package cn.hutool.extra.pinyin.engine.pinyin4j; + +import cn.hutool.core.util.ArrayUtil; +import cn.hutool.extra.pinyin.PinyinEngine; +import cn.hutool.extra.pinyin.PinyinException; +import net.sourceforge.pinyin4j.PinyinHelper; +import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType; +import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat; +import net.sourceforge.pinyin4j.format.HanyuPinyinToneType; +import net.sourceforge.pinyin4j.format.HanyuPinyinVCharType; +import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination; + +/** + * 封装了Pinyin4j的引擎。 + * + *

+ * pinyin4j(http://sourceforge.net/projects/pinyin4j)封装。 + *

+ * + *

+ * 引入: + *

+ * <dependency>
+ *     <groupId>com.belerweb</groupId>
+ *     <artifactId>pinyin4j</artifactId>
+ *     <version>2.5.1</version>
+ * </dependency>
+ * 
+ * + * @author looly + */ +public class Pinyin4jEngine implements PinyinEngine { + + //设置汉子拼音输出的格式 + HanyuPinyinOutputFormat format; + + /** + * 构造 + */ + public Pinyin4jEngine() { + this(null); + } + + /** + * 构造 + * + * @param format 格式 + */ + public Pinyin4jEngine(HanyuPinyinOutputFormat format) { + init(format); + } + + /** + * 初始化 + * + * @param format 格式 + */ + public void init(HanyuPinyinOutputFormat format) { + if (null == format) { + format = new HanyuPinyinOutputFormat(); + // 小写 + format.setCaseType(HanyuPinyinCaseType.LOWERCASE); + // 不加声调 + format.setToneType(HanyuPinyinToneType.WITHOUT_TONE); + // 'ü' 使用 "v" 代替 + format.setVCharType(HanyuPinyinVCharType.WITH_V); + } + this.format = format; + } + + @Override + public String getPinyin(char c) { + String result; + try { + String[] results = PinyinHelper.toHanyuPinyinStringArray(c, format); + result = ArrayUtil.isEmpty(results) ? String.valueOf(c) : results[0]; + } catch (BadHanyuPinyinOutputFormatCombination e) { + result = String.valueOf(c); + } + return result; + } + + @Override + public String getPinyin(String str, String separator) { + try { + return PinyinHelper.toHanYuPinyinString(str, format, separator, true); + } catch (BadHanyuPinyinOutputFormatCombination e) { + throw new PinyinException(e); + } + } + +} diff --git a/hutool-extra/src/main/java/cn/hutool/extra/pinyin/engine/pinyin4j/package-info.java b/hutool-extra/src/main/java/cn/hutool/extra/pinyin/engine/pinyin4j/package-info.java new file mode 100644 index 000000000..baf1df160 --- /dev/null +++ b/hutool-extra/src/main/java/cn/hutool/extra/pinyin/engine/pinyin4j/package-info.java @@ -0,0 +1,20 @@ +/** + * 封装了Pinyin4j的引擎。 + * + *

+ * pinyin4j(http://sourceforge.net/projects/pinyin4j)封装。 + *

+ * + *

+ * 引入: + *

+ * <dependency>
+ *     <groupId>com.belerweb</groupId>
+ *     <artifactId>pinyin4j</artifactId>
+ *     <version>2.5.1</version>
+ * </dependency>
+ * 
+ * + * @author looly + */ +package cn.hutool.extra.pinyin.engine.pinyin4j; \ No newline at end of file diff --git a/hutool-extra/src/main/java/cn/hutool/extra/pinyin/engine/tinypinyin/TinyPinyinEngine.java b/hutool-extra/src/main/java/cn/hutool/extra/pinyin/engine/tinypinyin/TinyPinyinEngine.java new file mode 100644 index 000000000..8d1850951 --- /dev/null +++ b/hutool-extra/src/main/java/cn/hutool/extra/pinyin/engine/tinypinyin/TinyPinyinEngine.java @@ -0,0 +1,56 @@ +package cn.hutool.extra.pinyin.engine.tinypinyin; + +import cn.hutool.extra.pinyin.PinyinEngine; +import com.github.promeg.pinyinhelper.Pinyin; + +/** + * 封装了TinyPinyin的引擎。 + * + *

+ * TinyPinyin(https://github.com/promeG/TinyPinyin)提供者未提交Maven中央库,
+ * 因此使用 + * https://github.com/biezhi/TinyPinyin打包的版本 + *

+ * + *

+ * 引入: + *

+ * <dependency>
+ *     <groupId>io.github.biezhi</groupId>
+ *     <artifactId>TinyPinyin</artifactId>
+ *     <version>2.0.3.RELEASE</version>
+ * </dependency>
+ * 
+ * + * @author looly + */ +public class TinyPinyinEngine implements PinyinEngine { + + /** + * 构造 + */ + public TinyPinyinEngine(){ + } + + /** + * 构造 + * @param config 配置 + */ + public TinyPinyinEngine(Pinyin.Config config){ + Pinyin.init(config); + } + + @Override + public String getPinyin(char c) { + if(false == Pinyin.isChinese(c)){ + return String.valueOf(c); + } + return Pinyin.toPinyin(c).toLowerCase(); + } + + @Override + public String getPinyin(String str, String separator) { + return Pinyin.toPinyin(str, separator).toLowerCase(); + } + +} diff --git a/hutool-extra/src/main/java/cn/hutool/extra/pinyin/engine/tinypinyin/package-info.java b/hutool-extra/src/main/java/cn/hutool/extra/pinyin/engine/tinypinyin/package-info.java new file mode 100644 index 000000000..01b947636 --- /dev/null +++ b/hutool-extra/src/main/java/cn/hutool/extra/pinyin/engine/tinypinyin/package-info.java @@ -0,0 +1,22 @@ +/** + * 封装了TinyPinyin的引擎。 + * + *

+ * TinyPinyin(https://github.com/promeG/TinyPinyin)提供者未提交Maven中央库,
+ * 因此使用 + * https://github.com/biezhi/TinyPinyin打包的版本 + *

+ * + *

+ * 引入: + *

+ * <dependency>
+ *     <groupId>io.github.biezhi</groupId>
+ *     <artifactId>TinyPinyin</artifactId>
+ *     <version>2.0.3.RELEASE</version>
+ * </dependency>
+ * 
+ * + * @author looly + */ +package cn.hutool.extra.pinyin.engine.tinypinyin; \ No newline at end of file diff --git a/hutool-extra/src/main/java/cn/hutool/extra/template/TemplateUtil.java b/hutool-extra/src/main/java/cn/hutool/extra/template/TemplateUtil.java index bb0cc8354..d5311a987 100644 --- a/hutool-extra/src/main/java/cn/hutool/extra/template/TemplateUtil.java +++ b/hutool-extra/src/main/java/cn/hutool/extra/template/TemplateUtil.java @@ -18,7 +18,7 @@ public class TemplateUtil { * @since 4.1.11 */ public static TemplateEngine createEngine() { - return createEngine(new TemplateConfig()); + return TemplateFactory.create(); } /** diff --git a/hutool-extra/src/main/java/cn/hutool/extra/template/engine/TemplateFactory.java b/hutool-extra/src/main/java/cn/hutool/extra/template/engine/TemplateFactory.java index f04207c92..9c7e4ed25 100644 --- a/hutool-extra/src/main/java/cn/hutool/extra/template/engine/TemplateFactory.java +++ b/hutool-extra/src/main/java/cn/hutool/extra/template/engine/TemplateFactory.java @@ -1,5 +1,6 @@ package cn.hutool.extra.template.engine; +import cn.hutool.core.lang.Singleton; import cn.hutool.core.util.ReflectUtil; import cn.hutool.core.util.ServiceLoaderUtil; import cn.hutool.core.util.StrUtil; @@ -14,6 +15,28 @@ import cn.hutool.log.StaticLog; * @author looly */ public class TemplateFactory { + + /** + * 根据用户引入的模板引擎jar,自动创建对应的模板引擎对象
+ * 获得的是单例的TemplateEngine + * + * @return 单例的TemplateEngine + */ + public static TemplateEngine get(){ + return Singleton.get(TemplateEngine.class.getName(), TemplateFactory::create); + } + + /** + * 根据用户引入的模板引擎jar,自动创建对应的模板引擎对象
+ * 推荐创建的引擎单例使用,此方法每次调用会返回新的引擎 + * + * @return {@link TemplateEngine} + * @since 5.3.3 + */ + public static TemplateEngine create() { + return create(new TemplateConfig()); + } + /** * 根据用户引入的模板引擎jar,自动创建对应的模板引擎对象
* 推荐创建的引擎单例使用,此方法每次调用会返回新的引擎 diff --git a/hutool-extra/src/main/java/cn/hutool/extra/tokenizer/engine/TokenizerFactory.java b/hutool-extra/src/main/java/cn/hutool/extra/tokenizer/engine/TokenizerFactory.java index b8c800f12..9c2a059aa 100644 --- a/hutool-extra/src/main/java/cn/hutool/extra/tokenizer/engine/TokenizerFactory.java +++ b/hutool-extra/src/main/java/cn/hutool/extra/tokenizer/engine/TokenizerFactory.java @@ -1,5 +1,6 @@ package cn.hutool.extra.tokenizer.engine; +import cn.hutool.core.lang.Singleton; import cn.hutool.core.util.ServiceLoaderUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.extra.tokenizer.TokenizerEngine; @@ -13,6 +14,18 @@ import cn.hutool.log.StaticLog; * */ public class TokenizerFactory { + + /** + * 根据用户引入的模板引擎jar,自动创建对应的分词引擎对象
+ * 获得的是单例的TokenizerEngine + * + * @return 单例的TokenizerEngine + * @since 5.3.3 + */ + public static TokenizerEngine get(){ + return Singleton.get(TokenizerEngine.class.getName(), TokenizerFactory::create); + } + /** * 根据用户引入的分词引擎jar,自动创建对应的分词引擎对象 * diff --git a/hutool-extra/src/main/resources/META-INF/services/cn.hutool.extra.pinyin.PinyinEngine b/hutool-extra/src/main/resources/META-INF/services/cn.hutool.extra.pinyin.PinyinEngine new file mode 100644 index 000000000..5526a0a33 --- /dev/null +++ b/hutool-extra/src/main/resources/META-INF/services/cn.hutool.extra.pinyin.PinyinEngine @@ -0,0 +1,3 @@ +cn.hutool.extra.pinyin.engine.tinypinyin.TinyPinyinEngine +cn.hutool.extra.pinyin.engine.jpinyin.JPinyinEngine +cn.hutool.extra.pinyin.engine.pinyin4j.Pinyin4jEngine \ No newline at end of file diff --git a/hutool-extra/src/test/java/cn/hutool/extra/pinyin/PinyinUtilTest.java b/hutool-extra/src/test/java/cn/hutool/extra/pinyin/PinyinUtilTest.java index a8e72e830..ef2164245 100644 --- a/hutool-extra/src/test/java/cn/hutool/extra/pinyin/PinyinUtilTest.java +++ b/hutool-extra/src/test/java/cn/hutool/extra/pinyin/PinyinUtilTest.java @@ -1,6 +1,5 @@ package cn.hutool.extra.pinyin; -import cn.hutool.core.util.ArrayUtil; import org.junit.Assert; import org.junit.Test; @@ -8,19 +7,19 @@ public class PinyinUtilTest { @Test public void getPinyinTest(){ - final String pinyin = PinyinUtil.getPinyin("你好", false); + final String pinyin = PinyinUtil.getPinyin("你好", " "); Assert.assertEquals("ni hao", pinyin); } @Test public void getPinyinUpperCaseTest(){ - final String pinyin = PinyinUtil.getPinyin("你好怡", true); - Assert.assertEquals("NI HAO YI", pinyin); + final String pinyin = PinyinUtil.getPinyin("你好怡", " "); + Assert.assertEquals("ni hao yi", pinyin); } @Test public void getFirstLetterTest(){ - final char[] result = PinyinUtil.getFirstLetter("H是第一个", false); - Assert.assertEquals("h, s, d, y, g", ArrayUtil.join(result, ", ")); + final String result = PinyinUtil.getFirstLetter("H是第一个", ", "); + Assert.assertEquals("h, s, d, y, g", result); } } diff --git a/hutool-log/src/main/java/cn/hutool/log/LogFactory.java b/hutool-log/src/main/java/cn/hutool/log/LogFactory.java index 1730230a1..b374fa4d6 100644 --- a/hutool-log/src/main/java/cn/hutool/log/LogFactory.java +++ b/hutool-log/src/main/java/cn/hutool/log/LogFactory.java @@ -53,12 +53,7 @@ public abstract class LogFactory { * @return 日志对象 */ public Log getLog(String name) { - Log log = logCache.get(name); - if (null == log) { - log = createLog(name); - logCache.put(name, log); - } - return log; + return logCache.computeIfAbsent(name, o -> createLog((String)o)); } /** @@ -68,12 +63,7 @@ public abstract class LogFactory { * @return 日志对象 */ public Log getLog(Class clazz) { - Log log = logCache.get(clazz); - if (null == log) { - log = createLog(clazz); - logCache.put(clazz, log); - } - return log; + return logCache.computeIfAbsent(clazz, o -> createLog((Class)o)); } /** diff --git a/hutool-script/.jython_cache/packages/access-bridge-64.pkc b/hutool-script/.jython_cache/packages/access-bridge-64.pkc new file mode 100644 index 000000000..0e514aee6 Binary files /dev/null and b/hutool-script/.jython_cache/packages/access-bridge-64.pkc differ diff --git a/hutool-script/.jython_cache/packages/ant-1.10.7.pkc b/hutool-script/.jython_cache/packages/ant-1.10.7.pkc new file mode 100644 index 000000000..f5837b967 Binary files /dev/null and b/hutool-script/.jython_cache/packages/ant-1.10.7.pkc differ diff --git a/hutool-script/.jython_cache/packages/ant-antlr-1.10.7.pkc b/hutool-script/.jython_cache/packages/ant-antlr-1.10.7.pkc new file mode 100644 index 000000000..df43bbfbf Binary files /dev/null and b/hutool-script/.jython_cache/packages/ant-antlr-1.10.7.pkc differ diff --git a/hutool-script/.jython_cache/packages/ant-junit-1.10.7.pkc b/hutool-script/.jython_cache/packages/ant-junit-1.10.7.pkc new file mode 100644 index 000000000..4cd971ee0 Binary files /dev/null and b/hutool-script/.jython_cache/packages/ant-junit-1.10.7.pkc differ diff --git a/hutool-script/.jython_cache/packages/ant-launcher-1.10.7.pkc b/hutool-script/.jython_cache/packages/ant-launcher-1.10.7.pkc new file mode 100644 index 000000000..f8a4ee06d Binary files /dev/null and b/hutool-script/.jython_cache/packages/ant-launcher-1.10.7.pkc differ diff --git a/hutool-script/.jython_cache/packages/apiguardian-api-1.1.0.pkc b/hutool-script/.jython_cache/packages/apiguardian-api-1.1.0.pkc new file mode 100644 index 000000000..d92e6985d Binary files /dev/null and b/hutool-script/.jython_cache/packages/apiguardian-api-1.1.0.pkc differ diff --git a/hutool-script/.jython_cache/packages/charsets.pkc b/hutool-script/.jython_cache/packages/charsets.pkc new file mode 100644 index 000000000..0b5b3700c Binary files /dev/null and b/hutool-script/.jython_cache/packages/charsets.pkc differ diff --git a/hutool-script/.jython_cache/packages/cldrdata.pkc b/hutool-script/.jython_cache/packages/cldrdata.pkc new file mode 100644 index 000000000..bd6e66e5d Binary files /dev/null and b/hutool-script/.jython_cache/packages/cldrdata.pkc differ diff --git a/hutool-script/.jython_cache/packages/deploy.pkc b/hutool-script/.jython_cache/packages/deploy.pkc new file mode 100644 index 000000000..880926b2b Binary files /dev/null and b/hutool-script/.jython_cache/packages/deploy.pkc differ diff --git a/hutool-script/.jython_cache/packages/dnsns.pkc b/hutool-script/.jython_cache/packages/dnsns.pkc new file mode 100644 index 000000000..1e2717032 Binary files /dev/null and b/hutool-script/.jython_cache/packages/dnsns.pkc differ diff --git a/hutool-script/.jython_cache/packages/groovy-3.0.2.pkc b/hutool-script/.jython_cache/packages/groovy-3.0.2.pkc new file mode 100644 index 000000000..e66355ec1 Binary files /dev/null and b/hutool-script/.jython_cache/packages/groovy-3.0.2.pkc differ diff --git a/hutool-script/.jython_cache/packages/groovy-ant-3.0.2.pkc b/hutool-script/.jython_cache/packages/groovy-ant-3.0.2.pkc new file mode 100644 index 000000000..7930855e2 Binary files /dev/null and b/hutool-script/.jython_cache/packages/groovy-ant-3.0.2.pkc differ diff --git a/hutool-script/.jython_cache/packages/groovy-astbuilder-3.0.2.pkc b/hutool-script/.jython_cache/packages/groovy-astbuilder-3.0.2.pkc new file mode 100644 index 000000000..fdc7c0a6b Binary files /dev/null and b/hutool-script/.jython_cache/packages/groovy-astbuilder-3.0.2.pkc differ diff --git a/hutool-script/.jython_cache/packages/groovy-cli-picocli-3.0.2.pkc b/hutool-script/.jython_cache/packages/groovy-cli-picocli-3.0.2.pkc new file mode 100644 index 000000000..5b9ed8bf4 Binary files /dev/null and b/hutool-script/.jython_cache/packages/groovy-cli-picocli-3.0.2.pkc differ diff --git a/hutool-script/.jython_cache/packages/groovy-console-3.0.2.pkc b/hutool-script/.jython_cache/packages/groovy-console-3.0.2.pkc new file mode 100644 index 000000000..2fc88f540 Binary files /dev/null and b/hutool-script/.jython_cache/packages/groovy-console-3.0.2.pkc differ diff --git a/hutool-script/.jython_cache/packages/groovy-datetime-3.0.2.pkc b/hutool-script/.jython_cache/packages/groovy-datetime-3.0.2.pkc new file mode 100644 index 000000000..faa763afc Binary files /dev/null and b/hutool-script/.jython_cache/packages/groovy-datetime-3.0.2.pkc differ diff --git a/hutool-script/.jython_cache/packages/groovy-docgenerator-3.0.2.pkc b/hutool-script/.jython_cache/packages/groovy-docgenerator-3.0.2.pkc new file mode 100644 index 000000000..79ec52042 Binary files /dev/null and b/hutool-script/.jython_cache/packages/groovy-docgenerator-3.0.2.pkc differ diff --git a/hutool-script/.jython_cache/packages/groovy-groovydoc-3.0.2.pkc b/hutool-script/.jython_cache/packages/groovy-groovydoc-3.0.2.pkc new file mode 100644 index 000000000..471cf6578 Binary files /dev/null and b/hutool-script/.jython_cache/packages/groovy-groovydoc-3.0.2.pkc differ diff --git a/hutool-script/.jython_cache/packages/groovy-groovysh-3.0.2.pkc b/hutool-script/.jython_cache/packages/groovy-groovysh-3.0.2.pkc new file mode 100644 index 000000000..17b66a2eb Binary files /dev/null and b/hutool-script/.jython_cache/packages/groovy-groovysh-3.0.2.pkc differ diff --git a/hutool-script/.jython_cache/packages/groovy-jmx-3.0.2.pkc b/hutool-script/.jython_cache/packages/groovy-jmx-3.0.2.pkc new file mode 100644 index 000000000..a10f66fea Binary files /dev/null and b/hutool-script/.jython_cache/packages/groovy-jmx-3.0.2.pkc differ diff --git a/hutool-script/.jython_cache/packages/groovy-json-3.0.2.pkc b/hutool-script/.jython_cache/packages/groovy-json-3.0.2.pkc new file mode 100644 index 000000000..2df0e6662 Binary files /dev/null and b/hutool-script/.jython_cache/packages/groovy-json-3.0.2.pkc differ diff --git a/hutool-script/.jython_cache/packages/groovy-jsr223-3.0.2.pkc b/hutool-script/.jython_cache/packages/groovy-jsr223-3.0.2.pkc new file mode 100644 index 000000000..c7e1138a6 Binary files /dev/null and b/hutool-script/.jython_cache/packages/groovy-jsr223-3.0.2.pkc differ diff --git a/hutool-script/.jython_cache/packages/groovy-macro-3.0.2.pkc b/hutool-script/.jython_cache/packages/groovy-macro-3.0.2.pkc new file mode 100644 index 000000000..60ae695e7 Binary files /dev/null and b/hutool-script/.jython_cache/packages/groovy-macro-3.0.2.pkc differ diff --git a/hutool-script/.jython_cache/packages/groovy-nio-3.0.2.pkc b/hutool-script/.jython_cache/packages/groovy-nio-3.0.2.pkc new file mode 100644 index 000000000..cd2e52792 Binary files /dev/null and b/hutool-script/.jython_cache/packages/groovy-nio-3.0.2.pkc differ diff --git a/hutool-script/.jython_cache/packages/groovy-servlet-3.0.2.pkc b/hutool-script/.jython_cache/packages/groovy-servlet-3.0.2.pkc new file mode 100644 index 000000000..622b32998 Binary files /dev/null and b/hutool-script/.jython_cache/packages/groovy-servlet-3.0.2.pkc differ diff --git a/hutool-script/.jython_cache/packages/groovy-sql-3.0.2.pkc b/hutool-script/.jython_cache/packages/groovy-sql-3.0.2.pkc new file mode 100644 index 000000000..b17277838 Binary files /dev/null and b/hutool-script/.jython_cache/packages/groovy-sql-3.0.2.pkc differ diff --git a/hutool-script/.jython_cache/packages/groovy-swing-3.0.2.pkc b/hutool-script/.jython_cache/packages/groovy-swing-3.0.2.pkc new file mode 100644 index 000000000..35f3668f7 Binary files /dev/null and b/hutool-script/.jython_cache/packages/groovy-swing-3.0.2.pkc differ diff --git a/hutool-script/.jython_cache/packages/groovy-templates-3.0.2.pkc b/hutool-script/.jython_cache/packages/groovy-templates-3.0.2.pkc new file mode 100644 index 000000000..2b473a64f Binary files /dev/null and b/hutool-script/.jython_cache/packages/groovy-templates-3.0.2.pkc differ diff --git a/hutool-script/.jython_cache/packages/groovy-test-3.0.2.pkc b/hutool-script/.jython_cache/packages/groovy-test-3.0.2.pkc new file mode 100644 index 000000000..8c6e5b9c9 Binary files /dev/null and b/hutool-script/.jython_cache/packages/groovy-test-3.0.2.pkc differ diff --git a/hutool-script/.jython_cache/packages/groovy-test-junit5-3.0.2.pkc b/hutool-script/.jython_cache/packages/groovy-test-junit5-3.0.2.pkc new file mode 100644 index 000000000..9e882305c Binary files /dev/null and b/hutool-script/.jython_cache/packages/groovy-test-junit5-3.0.2.pkc differ diff --git a/hutool-script/.jython_cache/packages/groovy-testng-3.0.2.pkc b/hutool-script/.jython_cache/packages/groovy-testng-3.0.2.pkc new file mode 100644 index 000000000..98602cab2 Binary files /dev/null and b/hutool-script/.jython_cache/packages/groovy-testng-3.0.2.pkc differ diff --git a/hutool-script/.jython_cache/packages/groovy-xml-3.0.2.pkc b/hutool-script/.jython_cache/packages/groovy-xml-3.0.2.pkc new file mode 100644 index 000000000..b9d1359bf Binary files /dev/null and b/hutool-script/.jython_cache/packages/groovy-xml-3.0.2.pkc differ diff --git a/hutool-script/.jython_cache/packages/hamcrest-core-1.3.pkc b/hutool-script/.jython_cache/packages/hamcrest-core-1.3.pkc new file mode 100644 index 000000000..af94c9e4b Binary files /dev/null and b/hutool-script/.jython_cache/packages/hamcrest-core-1.3.pkc differ diff --git a/hutool-script/.jython_cache/packages/idea_rt.pkc b/hutool-script/.jython_cache/packages/idea_rt.pkc new file mode 100644 index 000000000..d6c1cf30c Binary files /dev/null and b/hutool-script/.jython_cache/packages/idea_rt.pkc differ diff --git a/hutool-script/.jython_cache/packages/jaccess.pkc b/hutool-script/.jython_cache/packages/jaccess.pkc new file mode 100644 index 000000000..869fc6ab9 Binary files /dev/null and b/hutool-script/.jython_cache/packages/jaccess.pkc differ diff --git a/hutool-script/.jython_cache/packages/javaparser-core-3.15.13.pkc b/hutool-script/.jython_cache/packages/javaparser-core-3.15.13.pkc new file mode 100644 index 000000000..6144999e6 Binary files /dev/null and b/hutool-script/.jython_cache/packages/javaparser-core-3.15.13.pkc differ diff --git a/hutool-script/.jython_cache/packages/javaws.pkc b/hutool-script/.jython_cache/packages/javaws.pkc new file mode 100644 index 000000000..3b0fdce01 Binary files /dev/null and b/hutool-script/.jython_cache/packages/javaws.pkc differ diff --git a/hutool-script/.jython_cache/packages/jce.pkc b/hutool-script/.jython_cache/packages/jce.pkc new file mode 100644 index 000000000..750952331 Binary files /dev/null and b/hutool-script/.jython_cache/packages/jce.pkc differ diff --git a/hutool-script/.jython_cache/packages/jcommander-1.72.pkc b/hutool-script/.jython_cache/packages/jcommander-1.72.pkc new file mode 100644 index 000000000..f519fa6ab Binary files /dev/null and b/hutool-script/.jython_cache/packages/jcommander-1.72.pkc differ diff --git a/hutool-script/.jython_cache/packages/jfr.pkc b/hutool-script/.jython_cache/packages/jfr.pkc new file mode 100644 index 000000000..9f59f040c Binary files /dev/null and b/hutool-script/.jython_cache/packages/jfr.pkc differ diff --git a/hutool-script/.jython_cache/packages/jfxrt.pkc b/hutool-script/.jython_cache/packages/jfxrt.pkc new file mode 100644 index 000000000..ff1fba20c Binary files /dev/null and b/hutool-script/.jython_cache/packages/jfxrt.pkc differ diff --git a/hutool-script/.jython_cache/packages/jfxswt.pkc b/hutool-script/.jython_cache/packages/jfxswt.pkc new file mode 100644 index 000000000..bdec129c4 Binary files /dev/null and b/hutool-script/.jython_cache/packages/jfxswt.pkc differ diff --git a/hutool-script/.jython_cache/packages/jline-2.14.6.pkc b/hutool-script/.jython_cache/packages/jline-2.14.6.pkc new file mode 100644 index 000000000..91e0d1e5d Binary files /dev/null and b/hutool-script/.jython_cache/packages/jline-2.14.6.pkc differ diff --git a/hutool-script/.jython_cache/packages/jsse.pkc b/hutool-script/.jython_cache/packages/jsse.pkc new file mode 100644 index 000000000..82ca3c432 Binary files /dev/null and b/hutool-script/.jython_cache/packages/jsse.pkc differ diff --git a/hutool-script/.jython_cache/packages/junit-4.13.pkc b/hutool-script/.jython_cache/packages/junit-4.13.pkc new file mode 100644 index 000000000..c8d36f039 Binary files /dev/null and b/hutool-script/.jython_cache/packages/junit-4.13.pkc differ diff --git a/hutool-script/.jython_cache/packages/junit-jupiter-api-5.6.0.pkc b/hutool-script/.jython_cache/packages/junit-jupiter-api-5.6.0.pkc new file mode 100644 index 000000000..5c38bdc67 Binary files /dev/null and b/hutool-script/.jython_cache/packages/junit-jupiter-api-5.6.0.pkc differ diff --git a/hutool-script/.jython_cache/packages/junit-jupiter-engine-5.6.0.pkc b/hutool-script/.jython_cache/packages/junit-jupiter-engine-5.6.0.pkc new file mode 100644 index 000000000..c203f8fdd Binary files /dev/null and b/hutool-script/.jython_cache/packages/junit-jupiter-engine-5.6.0.pkc differ diff --git a/hutool-script/.jython_cache/packages/junit-platform-commons-1.6.0.pkc b/hutool-script/.jython_cache/packages/junit-platform-commons-1.6.0.pkc new file mode 100644 index 000000000..165c7396a Binary files /dev/null and b/hutool-script/.jython_cache/packages/junit-platform-commons-1.6.0.pkc differ diff --git a/hutool-script/.jython_cache/packages/junit-platform-engine-1.6.0.pkc b/hutool-script/.jython_cache/packages/junit-platform-engine-1.6.0.pkc new file mode 100644 index 000000000..2c1246bdf Binary files /dev/null and b/hutool-script/.jython_cache/packages/junit-platform-engine-1.6.0.pkc differ diff --git a/hutool-script/.jython_cache/packages/junit-platform-launcher-1.6.0.pkc b/hutool-script/.jython_cache/packages/junit-platform-launcher-1.6.0.pkc new file mode 100644 index 000000000..d19a5da0e Binary files /dev/null and b/hutool-script/.jython_cache/packages/junit-platform-launcher-1.6.0.pkc differ diff --git a/hutool-script/.jython_cache/packages/junit-rt.pkc b/hutool-script/.jython_cache/packages/junit-rt.pkc new file mode 100644 index 000000000..871581e6c Binary files /dev/null and b/hutool-script/.jython_cache/packages/junit-rt.pkc differ diff --git a/hutool-script/.jython_cache/packages/junit-vintage-engine-5.6.0.pkc b/hutool-script/.jython_cache/packages/junit-vintage-engine-5.6.0.pkc new file mode 100644 index 000000000..39029797d Binary files /dev/null and b/hutool-script/.jython_cache/packages/junit-vintage-engine-5.6.0.pkc differ diff --git a/hutool-script/.jython_cache/packages/junit5-rt.pkc b/hutool-script/.jython_cache/packages/junit5-rt.pkc new file mode 100644 index 000000000..4638c5216 Binary files /dev/null and b/hutool-script/.jython_cache/packages/junit5-rt.pkc differ diff --git a/hutool-script/.jython_cache/packages/jython-2.7.2.pkc b/hutool-script/.jython_cache/packages/jython-2.7.2.pkc new file mode 100644 index 000000000..9c7f230a0 Binary files /dev/null and b/hutool-script/.jython_cache/packages/jython-2.7.2.pkc differ diff --git a/hutool-script/.jython_cache/packages/localedata.pkc b/hutool-script/.jython_cache/packages/localedata.pkc new file mode 100644 index 000000000..4a1bb0849 Binary files /dev/null and b/hutool-script/.jython_cache/packages/localedata.pkc differ diff --git a/hutool-script/.jython_cache/packages/lombok-1.18.12.pkc b/hutool-script/.jython_cache/packages/lombok-1.18.12.pkc new file mode 100644 index 000000000..82932f5a7 Binary files /dev/null and b/hutool-script/.jython_cache/packages/lombok-1.18.12.pkc differ diff --git a/hutool-script/.jython_cache/packages/luaj-jse-3.0.1.pkc b/hutool-script/.jython_cache/packages/luaj-jse-3.0.1.pkc new file mode 100644 index 000000000..a2d6cd334 Binary files /dev/null and b/hutool-script/.jython_cache/packages/luaj-jse-3.0.1.pkc differ diff --git a/hutool-script/.jython_cache/packages/management-agent.pkc b/hutool-script/.jython_cache/packages/management-agent.pkc new file mode 100644 index 000000000..260e406b9 Binary files /dev/null and b/hutool-script/.jython_cache/packages/management-agent.pkc differ diff --git a/hutool-script/.jython_cache/packages/nashorn.pkc b/hutool-script/.jython_cache/packages/nashorn.pkc new file mode 100644 index 000000000..e979d6f8b Binary files /dev/null and b/hutool-script/.jython_cache/packages/nashorn.pkc differ diff --git a/hutool-script/.jython_cache/packages/opentest4j-1.2.0.pkc b/hutool-script/.jython_cache/packages/opentest4j-1.2.0.pkc new file mode 100644 index 000000000..42b1a1afa Binary files /dev/null and b/hutool-script/.jython_cache/packages/opentest4j-1.2.0.pkc differ diff --git a/hutool-script/.jython_cache/packages/packages.idx b/hutool-script/.jython_cache/packages/packages.idx new file mode 100644 index 000000000..8bd2536a7 Binary files /dev/null and b/hutool-script/.jython_cache/packages/packages.idx differ diff --git a/hutool-script/.jython_cache/packages/picocli-4.1.4.pkc b/hutool-script/.jython_cache/packages/picocli-4.1.4.pkc new file mode 100644 index 000000000..eea530c9d Binary files /dev/null and b/hutool-script/.jython_cache/packages/picocli-4.1.4.pkc differ diff --git a/hutool-script/.jython_cache/packages/plugin.pkc b/hutool-script/.jython_cache/packages/plugin.pkc new file mode 100644 index 000000000..c951ef617 Binary files /dev/null and b/hutool-script/.jython_cache/packages/plugin.pkc differ diff --git a/hutool-script/.jython_cache/packages/qdox-1.12.1.pkc b/hutool-script/.jython_cache/packages/qdox-1.12.1.pkc new file mode 100644 index 000000000..dc6d639b2 Binary files /dev/null and b/hutool-script/.jython_cache/packages/qdox-1.12.1.pkc differ diff --git a/hutool-script/.jython_cache/packages/resources.pkc b/hutool-script/.jython_cache/packages/resources.pkc new file mode 100644 index 000000000..174ee52db Binary files /dev/null and b/hutool-script/.jython_cache/packages/resources.pkc differ diff --git a/hutool-script/.jython_cache/packages/rt.pkc b/hutool-script/.jython_cache/packages/rt.pkc new file mode 100644 index 000000000..a5f2bae31 Binary files /dev/null and b/hutool-script/.jython_cache/packages/rt.pkc differ diff --git a/hutool-script/.jython_cache/packages/sunec.pkc b/hutool-script/.jython_cache/packages/sunec.pkc new file mode 100644 index 000000000..86041143a Binary files /dev/null and b/hutool-script/.jython_cache/packages/sunec.pkc differ diff --git a/hutool-script/.jython_cache/packages/sunjce_provider.pkc b/hutool-script/.jython_cache/packages/sunjce_provider.pkc new file mode 100644 index 000000000..cf73916e4 Binary files /dev/null and b/hutool-script/.jython_cache/packages/sunjce_provider.pkc differ diff --git a/hutool-script/.jython_cache/packages/sunmscapi.pkc b/hutool-script/.jython_cache/packages/sunmscapi.pkc new file mode 100644 index 000000000..25f66dd28 Binary files /dev/null and b/hutool-script/.jython_cache/packages/sunmscapi.pkc differ diff --git a/hutool-script/.jython_cache/packages/sunpkcs11.pkc b/hutool-script/.jython_cache/packages/sunpkcs11.pkc new file mode 100644 index 000000000..7d8462162 Binary files /dev/null and b/hutool-script/.jython_cache/packages/sunpkcs11.pkc differ diff --git a/hutool-script/.jython_cache/packages/testng-6.14.3.pkc b/hutool-script/.jython_cache/packages/testng-6.14.3.pkc new file mode 100644 index 000000000..bc854fdbc Binary files /dev/null and b/hutool-script/.jython_cache/packages/testng-6.14.3.pkc differ diff --git a/hutool-script/.jython_cache/packages/tools.pkc b/hutool-script/.jython_cache/packages/tools.pkc new file mode 100644 index 000000000..af72950b9 Binary files /dev/null and b/hutool-script/.jython_cache/packages/tools.pkc differ diff --git a/hutool-script/.jython_cache/packages/zipfs.pkc b/hutool-script/.jython_cache/packages/zipfs.pkc new file mode 100644 index 000000000..b61230cd1 Binary files /dev/null and b/hutool-script/.jython_cache/packages/zipfs.pkc differ