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

📄 conversionexception.java

📁 A Java web application, based on Struts and Hibernate, that serves as an online running log. Users m
💻 JAVA
字号:
/* @LICENSE_COPYRIGHT@ */package net.sf.irunninglog.util;/** * Exception thrown when a value cannot be converted from one type to another. * * @author <a href="mailto:allan_e_lewis@yahoo.com">Allan Lewis</a> * @version $Revision: 1.1.1.1 $ $Date: 2005/06/23 01:49:03 $ * @since iRunningLog 1.0 */public class ConversionException extends Exception {    /**     * Create a new exception indicating a failed conversion.     *     * @param value The value that failed conversion     * @param fromClass The class of the value     * @param toClass The class that the value could not be converted to     */    public ConversionException(Object value, Class fromClass, Class toClass) {        super(buildMessage(value, fromClass, toClass));    }    /**     * Build up the detail message for the exception.     *     * @param value The value that failed conversion     * @param fromClass The class of the value     * @param toClass The class that the value could not be converted to     * @return The detail message to use in creating the exception     */    private static String buildMessage(Object value,                                       Class fromClass, Class toClass) {        StringBuffer buf = new StringBuffer();        buf.append("Error performing conversion: unable to convert '");        buf.append(value);        buf.append("' from ");        buf.append(fromClass.getName());        buf.append(" to ");        buf.append(toClass.getName());        return buf.toString();    }}

⌨️ 快捷键说明

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