com.silentgo.utils.convertor.StringToIntegerConvertor Maven / Gradle / Ivy
package com.silentgo.utils.convertor;
import com.silentgo.utils.inter.ITypeConvertor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Project : silentgo
* com.silentgo.kit.typeconvert.support
*
* @author teddyzhu
*
* Created by teddyzhu on 16/7/26.
*/
public class StringToIntegerConvertor implements ITypeConvertor {
private Logger LOGGER = LoggerFactory.getLogger(StringToIntegerConvertor.class);
@Override
public Integer convert(String source) {
Integer target = null;
try {
target = Integer.valueOf(source);
} catch (NumberFormatException e) {
e.printStackTrace();
LOGGER.error(e.getMessage());
}
return target;
}
}