/**
* 为BeanUtilsBean提供缺省的日期转换器
*/
public void addDefaultDateConverter() {
JRest4GuiceHelper.addBeanConvert(new Converter() {
@Override
public Object convert(Class type, Object value) {
if (type != java.sql.Time.class || value == null
|| value.toString().trim().equals(""))
return null;
Object result = DatePatternConverter.this.format(value
.toString());
if (result == null) {
try {
result = new java.sql.Time(Long.parseLong(value
.toString()));
} catch (Exception e) {
}
}
return result;
}
}, java.sql.Time.class);
JRest4GuiceHelper.addBeanConvert(new Converter() {
@Override
public Object convert(Class type, Object value) {
if (type != java.util.Date.class || value == null
|| value.toString().trim().equals(""))
return null;
Object result = DatePatternConverter.this.format(value
.toString());
if (result == null) {
try {
result = new java.util.Date(Long.parseLong(value
.toString()));
} catch (Exception e) {
}
}
return result;
}
}, java.util.Date.class);
JRest4GuiceHelper.addBeanConvert(new Converter() {
@Override
public Object convert(Class type, Object value) {
if (type != java.sql.Date.class || value == null
|| value.toString().trim().equals(""))
return null;