com.quhaodian.web.conver.StringToDateConverterFactory Maven / Gradle / Ivy
package com.quhaodian.web.conver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.convert.converter.Converter;
import java.util.Date;
public class StringToDateConverterFactory implements Converter {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Override
public Date convert(String source) {
if (source == null||"".equals(source)) {
return null;
}
source = source.trim();
if (source.equals("")) {
return null;
}
return DateConver.getDefault().conver(source);
}
}