自动转换
class Foo {
Long id = 1L;
int flag = 1;
}
class FooDto {
String id;
boolean flag;
}
FooDto fooDto = BeanUtils.copyProperties(foo, FooDto.class);
System.out.println(fooDto.getId()); // "1"
System.out.println(footDto.getFlag()); // true支持的自动转换
Java 8 Date API(LocalDate/LocalTime/LocalDateTime)和Date的互相转换
任意日期类型和时间戳(长整形)的互相转换
字符串转换为数值类型(Integer/Long/Float/Double)或布尔值
数值类型转换为数值类型(Integer/Long/Float/Double)或布尔值
任意对象转换为字符串
Last updated