All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.gjing.tools.excel.convert.LongConvert Maven / Gradle / Ivy

package cn.gjing.tools.excel.convert;

import org.springframework.util.StringUtils;

/**
 * Converts the string to a Java Long
 * @author Gjing
 **/
public class LongConvert implements DataConvert {
    @Override
    public Object toEntityAttribute(Object entity, Object value) {
        return StringUtils.isEmpty(value) ? 0L : Long.parseLong(value.toString());
    }

    @Override
    public Object toExcelAttribute(Object entity, Object value) {
        return value;
    }
}