mirror of
https://gitee.com/dromara/hutool.git
synced 2025-04-05 17:37:59 +08:00
add methods
This commit is contained in:
parent
cdfae52eb9
commit
c1642522bb
@ -27,6 +27,7 @@
|
||||
* 【core 】 增加ResourceClassLoader、CharSequenceResource、FileObjectResource
|
||||
* 【core 】 修改IoUtil.read(Reader)逻辑默认关闭Reader
|
||||
* 【core 】 ZipUtil增加Zip方法(pr#222@Gitee)
|
||||
* 【all 】 增加Hutool.getAllUtils和printAllUtils方法
|
||||
|
||||
### Bug修复
|
||||
* 【cron 】 修复CronTimer可能死循环的问题(issue#1224@Github)
|
||||
|
@ -16,24 +16,51 @@
|
||||
|
||||
package cn.hutool;
|
||||
|
||||
import cn.hutool.core.lang.ConsoleTable;
|
||||
import cn.hutool.core.util.ClassUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Hutool是一个小而全的Java工具类库,通过静态方法封装,降低相关API的学习成本,提高工作效率,使Java拥有函数式语言般的优雅,让Java语言也可以“甜甜的”。
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Hutool中的工具方法来自于每个用户的精雕细琢,它涵盖了Java开发底层代码中的方方面面,它既是大型项目开发中解决小问题的利器,也是小型项目中的效率担当;<br>
|
||||
* </p>
|
||||
*
|
||||
* <p>Hutool是项目中“util”包友好的替代,它节省了开发人员对项目中公用类和公用工具方法的封装时间,使开发专注于业务,同时可以最大限度的避免封装不完善带来的bug。</p>
|
||||
*
|
||||
* @author Looly
|
||||
*
|
||||
* @author Looly
|
||||
*/
|
||||
public class Hutool {
|
||||
|
||||
|
||||
public static final String AUTHOR = "Looly";
|
||||
|
||||
|
||||
private Hutool() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示Hutool所有的工具类
|
||||
*
|
||||
* @since 5.5.2
|
||||
*/
|
||||
public static Set<Class<?>> getAllUtils() {
|
||||
return ClassUtil.scanPackage("cn.hutool",
|
||||
(clazz) -> (false == clazz.isInterface()) && StrUtil.endWith(clazz.getSimpleName(), "Util"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 控制台打印所有工具类
|
||||
*/
|
||||
public static void printAllUtils() {
|
||||
final Set<Class<?>> allUtils = getAllUtils();
|
||||
final ConsoleTable consoleTable = ConsoleTable.create().addHeader("工具类名", "所在包");
|
||||
for (Class<?> clazz : allUtils) {
|
||||
consoleTable.addBody(clazz.getSimpleName(), clazz.getPackage().getName());
|
||||
}
|
||||
consoleTable.print();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user