commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Frost, Gary" <gary.fr...@citigroup.com>
Subject RE: commons-validator : HaspMap/Collection instead of JavaBean
Date Thu, 06 Nov 2003 22:06:17 GMT
Yuvraj,

I suspect you want to take a look at Commons - BeanUtils
	http://jakarta.apache.org/commons/beanutils.html


WRT the use of a Hashmap/Collection with the Validator, I'm not totally sure
if you can, I'm sure someone else will pipe in here :D, but I know you can
use the DynaBean class from the BeanUtils package with validation, its a
pretty damned handy class.  My understanding is that the Validator packages
use BeanUtils - PropertyUtils to access the bean's fields, so my punt is
that you can prolly use a Hashmap/Collection as long as you structure your
validator config correctly.

Have a look in the BeanUtils.populate(), BeanUtils.copyProperties() and
PropertyUtiils.copyProperties() .

WRT to XML based definition of a JavaBean, not sure what you're after here
exactly, my suggestion would be to look at the DynaBean, also DynaClass, and
if you really need to extract that kind of info from an XML file, maybe look
at Commons Digester.

Gary

> -----Original Message-----
> From: Yuvraj Waswani [mailto:Yuvraj.Waswani@tavant.com]
> Sent: Friday, 7 November 2003 12:34 AM
> To: commons-user@jakarta.apache.org
> Subject: commons-validator : HaspMap/Collection instead of JavaBean 
> 
> 
> Hi,
>  
> Can we use Hashmap or any other Collection instead of a JavaBean with
> Validator? If not, what alternatives do I have to be able to convert a
> HashMap/Collection to a JavaBean WITHOUT any pre-existing 
> Bean definition?
> (The Collection/HashMap I get from the application is dynamic 
> in nature and
> so cannot have a predefined JavaBean class for it). 
>  
> I take this mail as an opportunity to ask another question :-- Can I
> construct a JavaBean (since it has to be used with Validator) 
> from an XML
> containing its definition (like javabean property names) , 
> again WITHOUT any
> pre-existing class definition?
>  
> Awaiting some response.
>  
> Thanks.
> 

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


Mime
View raw message