Post

BeanUtilsBean2 Populate sql.Time From/To Jodatime LocalTime

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 LocalTime.parse((String) value, DateTimeFormat.forPattern("HHmm"));
		} catch (Exception ex) {
			return null;
		}
	}}, LocalTime.class);
This post is licensed under CC BY 4.0 by the author.