1、类型转换工具类-Convert
如
int a = 1;
//aStr为"1"
String aStr = Convert.toStr(a);
2、日期时间工具类
DateTime
Date date = DateUtil.date();
3、文本读取-FileReader
FileReader fileReader = new FileReader("test.properties");
String result = fileReader.readString();
文本写入-FileWriter
FileWriter writer = new FileWriter("test.properties");
writer.write("test");
文件名工具类-FileNameUtil
File file = FileUtil.file("/opt/test.txt");
// test.txt
String name = FileNameUtil.getName(file);
4、随机工具-RandomUtil
int c = RandomUtil.randomInt(10, 100);
5、唯一Id工具-IdUtil
//生成的UUID是带-的字符串,类似于:a5c8a5e8-df2b-4706-bea4-08d0939410e3
String uuid = IdUtil.randomUUID();
//生成的是不带-的字符串,类似于:b17f24ff026d40949c85a24f4f375d42
String simpleUUID = IdUtil.simpleUUID();
雪花算法Id
//参数1为终端ID
//参数2为数据中心ID
Snowflake snowflake = IdUtil.getSnowflake(1, 1);
long id = snowflake.nextId();
//简单使用
long id = IdUtil.getSnowflakeNextId();
String id = snowflake.getSnowflakeNextIdStr();
6、字符串工具类-StrUtil
7、Bean工具-BeanUtil
Bean转Map
SubPerson person = new SubPerson();
person.setAge(14);
person.setOpenid("11213232");
person.setName("测试A11");
person.setSubName("sub名字");
Map<String, Object> map = BeanUtil.beanToMap(person);
具体的查看官网
06-27
3042

12-15
1865

07-27
3560

12-06
7368

04-27
123
