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

📄 runnerformbean.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.servlet.formbean;import java.util.List;import org.apache.commons.logging.Log;import org.apache.commons.logging.LogFactory;import net.sf.irunninglog.canonical.CanonicalUtilities;import net.sf.irunninglog.canonical.Runner;import net.sf.irunninglog.util.DTO;/** * Form bean representation of the <em>Runner</em> business object.  Used to * provide an implementation of the <em>Runner</em> object within the * application's view tier. * * @author <a href="mailto:allan_e_lewis@yahoo.com">Allan Lewis</a> * @version $Revision: 1.1.1.1 $ $Date: 2005/06/23 01:49:02 $ * @since iRunningLog 1.0 */public final class RunnerFormBean extends HasRunnerIdFormBean {    /** <code>Log</code> instance for this class. */    private static final Log LOG = LogFactory.getLog(RunnerFormBean.class);    /** Valid values for the <em>gender</em> field. */    private static final List VALID_GENDER_VALUES;    /** The bean's <em>name</em> field. */    private String mName;    /** The bean's <em>email</em> field. */    private String email;    /** The bean's <em>date of birth</em> field. */    private String mDateOfBirth;    /** The bean's <em>age</em> field. */    private String mAge;    /** The bean's <em>gender</em> field. */    private String mGender;    static {        VALID_GENDER_VALUES =                        CanonicalUtilities.getValidValues(Runner.CANONICAL_ID,                                                          Runner.FIELD_GENDER);    }    /**     * Create a new form bean.     */    public RunnerFormBean() {        super();    }    /**     * Get the value of the bean's <em>name</em> field.     *     * @return The current value of the <em>name</em> field     */    public String getName() {        return mName;    }    /**     * Set the value of the bean's <em>name</em> field.     *     * @param value The value to be set onto the <em>name</em> field     */    public void setName(String value) {        mName = value;    }    /**     * Get the value of the bean's <em>email</em> field.     *     * @return The current value of the <em>email</em> field     */    public String getEmail() {        return email;    }    /**     * Set the value of the bean's <em>email</em> field.     *     * @param value The value to be set onto the <em>email</em> field     */    public void setEmail(String value) {        email = value;    }    /**     * Get the value of the bean's <em>date of birth</em> field.     *     * @return The current value of the <em>date of birth</em> field     */    public String getDateOfBirth() {        return mDateOfBirth;    }    /**     * Set the value of the bean's <em>date of birth</em> field.     *     * @param value The value to be set onto the <em>date of birth</em> field     */    public void setDateOfBirth(String value) {        mDateOfBirth = value;    }    /**     * Get the value of the bean's <em>age</em> field.     *     * @return The current value of the <em>age</em> field     */    public String getAge() {        return mAge;    }    /**     * Set the value of the bean's <em>age</em> field.     *     * @param value The value to be set onto the <em>age</em> field     */    public void setAge(String value) {        mAge = value;    }    /**     * Get the value of the bean's <em>gender</em> field.     *     * @return The current value of the <em>gender</em> field     */    public String getGender() {        return mGender;    }    /**     * Set the value of the bean's <em>gender</em> field.     *     * @param value The value to be set onto the <em>gender</em> field     */    public void setGender(String value) {        mGender = value;    }    /**     * Get the list of valid values for the <code>gender</code> field.  This     * will return a list of strings comprising the set of valid values.  Note:     * the list will NOT contain a blank/null value.  It is up to the view     * to determine whether or not a blank value should be present.     *     * @return A list of <code>String</code> representing the allowed values     *         for the <em>gender</em> field     */    public List getValidGenderValues() {        return VALID_GENDER_VALUES;    }    /**     * Retrieve the form bean's values.     *     * @return A transfer object representing the for bean's state     */    public DTO getValues() {        DTO valueObject = super.getValues();        if (LOG.isDebugEnabled()) {            LOG.debug("getValues: Contents of the value object "                      + " (before) " + valueObject);        }        valueObject.setCanonicalId(Runner.CANONICAL_ID);        valueObject.setValue(Runner.FIELD_NAME, getName());        valueObject.setValue(Runner.FIELD_EMAIL, getEmail());        valueObject.setValue(Runner.FIELD_DATE_OF_BIRTH, getDateOfBirth());        valueObject.setValue(Runner.FIELD_AGE, getAge());        valueObject.setValue(Runner.FIELD_GENDER, getGender());        if (LOG.isDebugEnabled()) {            LOG.debug("getValues: Contents of the value object "                      + " (after) " + valueObject);        }        return valueObject;    }    /**     * Update the form bean's values.     *     * @param valueObject Value object containing the new values     *                    to be applied to the form bean     */    public void setValues(DTO valueObject) {        if (LOG.isDebugEnabled()) {            LOG.debug("setValues: Contents of the value object "                      + valueObject);        }        super.setValues(valueObject);        setName(valueObject.getValue(Runner.FIELD_NAME));        setEmail(valueObject.getValue(Runner.FIELD_EMAIL));        setDateOfBirth(valueObject.getValue(Runner.FIELD_DATE_OF_BIRTH));        setAge(valueObject.getValue(Runner.FIELD_AGE));        setGender(valueObject.getValue(Runner.FIELD_GENDER));    }}

⌨️ 快捷键说明

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