why not go with full blown jsr 303? :-) http://incubator.apache.org/bval/cwiki/index.html
-------- Original Message -------- Subject: Text validators From: Sandro Martini <[email protected]> To: Apache Pivot - Developers <[email protected]> Date: Fri 17 Jun 2011 06:10:18 PM CDT > Hi all, > I'm thinking to add some (I know, trivial but common in real-world > examples) validators for text fields (aligned with other validators, > but useful to me for starting a more general solution for the future), > like NotNullValidator (if text fields never returns a null maybe this > could not be done), NotEmptyValidator, DateValidator (using the > default locale) and maybe others ... for the 2.0.1 . > > Maybe for the 2.1 we could think to change the subject of Validators > from String to Object (maybe with generics, so cast only when > desired), to being able to handle more general data validation, Ok ? > > (1) What do you think ? > > > And last (but maybe this for the 2.1 release, I could open a ticket > for this), a Validator interface (like that in JSF) that I could for > example attach to a Pivot Form, in Java code and/or in bxml (like in a > JSF/HTML Form) and let it handle all validation of Form fields ... > without having to work only on Strings (as currently our validators > do). > And create a class to handle validation messages, like severity (info, > warning, error), label, id of the component that this message refers > to (the skin here could use this to display a flag, or an overlay, or > other, or none and display all messages in another place), etc ... and > maybe handle a List of ValidationMessage inside a Form, if wanted. > For a sample signature (JSF-2.0): > http://download.oracle.com/docs/cd/E17802_01/j2ee/javaee/javaserverfaces/2.0/docs/api/javax/faces/validator/Validator.html > http://java.dzone.com/articles/jsf-validation-tutorial-error > We could even make a validate() method without parameters, but to > store messages etc probably something like JSF Validators is good. > > (2) What do you think ? > > > Bye > >
