⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 datatypeconverter.java

📁 这是一个轻便的j2ee的web应用框架,是一个在多个项目中运用的实际框架,采用struts,hebinate,xml等技术,有丰富的tag,role,navigation,session,dictio
💻 JAVA
字号:
/*
 * Created on 2004-2-27
 *
 * To change the template for this generated file go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
package com.esimple.framework.util;

import java.math.BigDecimal;
/**
 * @author steven
 *
 */
public class DataTypeConverter {
	public static int toInt(String value) throws ConvertException{
		try {
			int intValue = new Integer( value ).intValue();
			return intValue;
		} catch (Exception e) {
			throw new ConvertException("can not convert String "+ value +" to int");
		}
		
	}
	public static float toFloat(String value) throws ConvertException{
		try {
			return  new Float( value ).floatValue();
		} catch (Exception e) {
			throw new ConvertException("can not convert String "+ value +" to float");
		}
		
	}
	public static double toDouble(String value) throws ConvertException{
		try {
			return  new Double( value ).doubleValue();
		} catch (Exception e) {
			throw new ConvertException("can not convert String "+ value +" to float");
		}
		
	}
	
	public static BigDecimal toBigDecimal(String value) throws ConvertException{
		try {
			return  new BigDecimal(value);
		} catch (Exception e) {
			throw new ConvertException("can not convert String "+ value +" to float");
		}
		
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -