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

cn.featherfly.conversion.string.basic.NumberConvertor Maven / Gradle / Ivy

There is a newer version: 1.5.0
Show newest version

package cn.featherfly.conversion.string.basic;

import cn.featherfly.common.lang.GenericType;
import cn.featherfly.common.lang.NumberUtils;
import cn.featherfly.common.lang.StringUtils;

/**
 * 

* 数字类型转换器 *

* @param 转换器对应的转换类型 * @author 钟冀 */ public abstract class NumberConvertor extends AbstractBasicConvertor> { /** */ public NumberConvertor() { } /** * {@inheritDoc} */ @Override protected String doToString(T value, GenericType genericType) { if (value != null) { return value.toString(); } return ""; } /** * {@inheritDoc} */ @Override protected T doToObject(String value, GenericType genericType) { if (StringUtils.isNotBlank(value)) { return NumberUtils.parse(value, getSourceType()); } return null; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy