BeanUtilsBean2 Populate String From/To Jodatime LocalDate
1
2
3
4
5
6
7
8
9
10
BeanUtilsBean2 beanUtilsBean = new BeanUtilsBean2();
beanUtilsBean.getConvertUtils().register(new Converter() {
@Override
public Object convert(Class type, Object value) {
try {
return LocalDate.parse((String) value, DateTimeFormat.forPattern("yyyy-MM-dd"));
} catch (Exception ex) {
return null;
}
}}, LocalTime.class);
This post is licensed under CC BY 4.0 by the author.