org.onetwo.common.convert.ToNiceDateConvertor Maven / Gradle / Ivy
package org.onetwo.common.convert;
import java.util.Date;
import org.onetwo.common.date.NiceDate;
public class ToNiceDateConvertor extends AbstractTypeConvert {
protected ToNiceDateConvertor() {
super(NiceDate.New(new Date(0)));
}
@Override
public NiceDate doConvert(Object value, Class> componentType) {
// if(value==null)
// return null;
Class> vtype = value.getClass();
NiceDate date = null;
if(Date.class.isAssignableFrom(vtype)){
date = NiceDate.New((Date)value);
}else{
throw new IllegalArgumentException("only support convert Date to NiceDate");
}
return date;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy