package xyz.wbsite.frame.excel.converter;

/**
 * IntegerConverter - Integer转化器，重写了对象到String，String到对象的转化方式
 *
 * @author wangbing
 * @version 0.0.1
 * @since 2017-01-01
 */
public class IntegerConverter implements Converter<Integer> {

    @Override
    public Integer convert(String var) {
        try {
            return Integer.parseInt(var);
        } catch (Exception e) {
            return 0;
        }
    }

    @Override
    public String string(Integer var) {
        if (var == null) {
            return "";
        }
        return String.valueOf(var);
    }
}
