commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Malani, Prakash" <PMal...@ebuilt.com>
Subject RE: [validator] It is too complicated
Date Thu, 20 Feb 2003 00:51:56 GMT
Hi,

How are you doing?  I feel the same way about the implementation being
complication.  I have created some helper classes that look similar to
Struts like ActionError and ActionErrors.  Enclosed jar file contains the
those classes.  The ValidatorExtTest demonstrates their usage (check out the
validateBean() method).  It might be even useful to include them as part of
the validator example.  

ValidatorMessage - Similar to Struts ActionError

ValidatorMessageMap - Similar to Struts ActionErrors

ValidationHelper - Wrappers creation of ValidatorResources

ValidationConvertor - Converts ValdationResults into ValidationMessageMap

ValidationFormatter - Converts ValidationMessageMap into flat list of
message.  

Comments and feedback are most welcome...

Best regards...

-----
Java, OOAD, UML, Design Patterns, EJBs, Struts, JSPs, Servlets, JMS, XP
(http://groups.yahoo.com/group/bartssandbox)
J2EE (http://www.cact.csupomona.edu/oncampus/programs/cert/j2ee/default.asp)
Java (http://www.cact.csupomona.edu/oncampus/programs/cert/java/Default.asp)
UML (http://www.cact.csupomona.edu/oncampus/programs/cert/uml/default.asp)
eBuilt, Inc. (http://www.eBuilt.com)
 

> Hello,
> 
> I have a feeling that validator api (or turbine-intake api) is too 
> complicated. Actually it is more implementation than api.
> 
> I think, the main thing in validation framework should be validation 
> action itself. Therefore validation framework should define 
> simple and 
> clear interface for validation: e.g.: Validator.
> 
> E.g.:
> public interface Validator {
>    public ValidationResult validate(Object, ValidationContext);
> }
> 
> Implementation of this interface should have no state and it 
> should be 
> thread safe. Then you can define validators which are atomic and 
> reusable even outside this framework.
> 
> ValidationResult object can contain message and status 
> (succeeded/failed) of the validation.
> 
> ValidationContext can hold a state of the validation. For example, it 
> can indicate if previously performed validations have succeeded. It 
> would be usefull for (non-)performing "expensive" validations.
> 
> Does anyone think it would make sence to have such simple validation 
> api? It would be perfect if both commons-validator and turbine-intake 
> use such common interface so you can plug-in your validators 
> to any of them.
> 
> Regards
> Vilmantas


Mime
  • Unnamed multipart/mixed (inline, None, 0 bytes)
View raw message