DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10761>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10761

Add getString helpers to DynaActionForm

           Summary: Add getString helpers to DynaActionForm
           Product: Struts
           Version: Nightly Build
          Platform: All
        OS/Version: Other
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Standard Actions
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


Now that I'm using DynaForms, I find I'm constants having to cast my gets to 
Strings in the Action.  Any problem with adding helpers for get to return it 
already cast to a String?

Index: DynaActionForm.java
===================================================================
RCS file: /home/cvspublic/jakarta-
struts/src/share/org/apache/struts/action/DynaActionForm.java,v
retrieving revision 1.2
diff -u -r1.2 DynaActionForm.java
--- DynaActionForm.java 18 Jan 2002 03:46:52 -0000      1.2
+++ DynaActionForm.java 12 Jul 2002 20:44:12 -0000
@@ -191,6 +191,20 @@
     }
 
 
+    /** Return the value of a simple property with the specified name,
+     *  cast into a String.
+     *
+     * @param name Name of the property whose value is to be retrieved
+     *
+     * @exception IllegalArgumentException if there is no property
+     *  of the specified name
+     */
+
+    public String getString(String name) {
+       return (String) get(name);
+    }
+
+
     /**
      * Return the value of a simple property with the specified name.
      *
@@ -238,6 +252,27 @@
 
 
     /**
+     * Return the value of an indexed property with the specified name,
+     * cast into a String.
+     *
+     * @param name Name of the property whose value is to be retrieved
+     * @param index Index of the value to be retrieved
+     *
+     * @exception IllegalArgumentException if there is no property
+     *  of the specified name
+     * @exception IllegalArgumentException if the specified property
+     *  exists, but is not indexed
+     * @exception IndexOutOfBoundsException if the specified index
+     *  is outside the range of the underlying property
+     * @exception NullPointerException if no array or List has been
+     *  initialized for this property
+     */
+
+    public String getString(String name, int index) {
+       return (String) get(name, index);
+    }
+
+    /**
      * Return the value of an indexed property with the specified name.
      *
      * @param name Name of the property whose value is to be retrieved
@@ -268,6 +303,24 @@
                 ("Non-indexed property for '" + name + "[" + index + "]'");
         }
 
+    }
+
+    /**
+     * Return the value of a mapped property with the specified name,
+     * cast to a String or <code>null</code> if there is no value for 
+     * the specified key.
+     *
+     * @param name Name of the property whose value is to be retrieved
+     * @param key Key of the value to be retrieved
+     *
+     * @exception IllegalArgumentException if there is no property
+     *  of the specified name
+     * @exception IllegalArgumentException if the specified property
+     *  exists, but is not mapped
+     */
+
+    public String getString(String name, String key) {
+       return (String) get(name, key);
     }

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to