You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2005/01/06 23:55:32 UTC

DO NOT REPLY [Bug 32978] New: - Validating Arrays of simple Objects

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

http://issues.apache.org/bugzilla/show_bug.cgi?id=32978

           Summary: Validating Arrays of simple Objects
           Product: Commons
           Version: 1.3 Final
          Platform: PC
        OS/Version: Windows 2000
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Validator
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: wjrf@optusnet.com.au


The Validator needs the ability to validate an array of simple Objects such as 
Strings. Ie it should be possible to define a bean like:
class foo {
  public String getBar();
  public void setBar(String[] values);
}
and have the values of Bar validated.

Currently (validator 1.1.3 as ships with Struts 1.2.8, and looks same in 1.1.4), 
to validate an array of properties you need to specify
  property='somePropertyName'
  indexedListProperty='propertyAtWhichCollectionIsFound'
This will iterate through the collection found at
'propertyAtWhichCollectionisFound',
and will validate the 'somePropertyName' property on each element.
But if it is a collection of Strings then there is no valid property name to define.
Ie you don't seem to be able to validate a collection of Strings.

To fix it, either 'property' needs to be optional (not recommended), or a new
approach to indexed properties needs to be taken. Perhaps by allowing 'property' 
to define where the array of values can be found as well as any property to 
validate on the elements (using dot notation), and having the Validator 
introspect the values at each step and determine whether ot needs to iterate
over a collection. This would also solve some of the enhancements requests
that have been made for the Validator.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org