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

📄 validationerror.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.validation;import java.io.Serializable;import net.sf.irunninglog.util.IError;/** * Object representing an validation error.  This class consists of the * information needed to construct an error message at some later time: * a key that identifies the error, and and a list of insert values to be * used in building a user-friendly message. * * <p/> * * This class is designed to be used in all application layers.  As such, it * has no knowledge of (or interest in) the values it contains.  It is up to * classes that interact with these errors to construct full error messages * for display to users of the application. * * @author <a href="mailto:allan_e_lewis@yahoo.com">Allan Lewis</a> * @version $Revision: 1.1.1.1 $ $Date: 2005/06/23 01:49:04 $ * @since iRunningLog 1.0 */public final class ValidationError implements IError, Serializable {    /** Key that uniquely identifies the error. */    private String mKey;    /** List of inserts to be used in constructing an error message. */    private String [] mInserts;    /**     * Construct a new error with the specified key.     *     * @param key The key to be assigned to the new error     */    public ValidationError(String key) {        this(key, new String []{});    }    /**     * Construct a new error with the specified key and a specified list     * of inserts.     *     * @param key The key to be assigned to the new error     * @param inserts The list of inserts for the new error     */    public ValidationError(String key, String [] inserts) {        super();        mKey = key;        mInserts = inserts;    }    /**     * Get the error's key.  This method will return the key that uniquely     * identifies the error.     *     * @return The error's key     */    public String getKey() {        return mKey;    }    /**     * Get the error's list of inserts.  This method will return a copy of the     * list to prevent external classes from modifying the list's values.     *     * @return The error's list of inserts     */    public String [] getInserts() {        return mInserts == null ? null : (String []) mInserts.clone();    }    /**     * Custom toString override to provide a meaningful <code>String</code>     * representation of this object.     *     * @return A <code>String</code> representation of this object     */    public String toString() {        StringBuffer buff = new StringBuffer();        buff.append("ValidationError[");        buff.append("key='");        buff.append(mKey);        buff.append("' ");        buff.append("inserts={");        for (int i = 0; i < mInserts.length; i++) {            buff.append("'");            buff.append(mInserts[i]);            buff.append("'");            if (i != mInserts.length - 1) {                buff.append(", ");            }        }        buff.append("}");        buff.append("]");        return buff.toString();    }}

⌨️ 快捷键说明

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