Quick question... my understanding of the BeanUtils' convertors is that it allows you to only register a one-way custom convertor, String->Class... however you mentioned below that you could also go the other direction, Class->String. Is this a future enhancement? Because after reading the BeanUtils documentation and looking through the source I have found that Class->String conversion doesn't use the registered convertor, rather it just calls toString() on the object. If this is a new enhancement, do you know when it will be out? And if it isn't, this would definitely be a feature we would like to have.
Thanks, Brian -----Original Message----- From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]] Sent: Friday, October 11, 2002 1:47 PM To: Struts Users Mailing List Subject: Re: Struts forms best practice On Fri, 11 Oct 2002, Eddie Bush wrote: > Date: Fri, 11 Oct 2002 12:58:17 -0500 > From: Eddie Bush <[EMAIL PROTECTED]> > Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]> > To: Struts Users Mailing List <[EMAIL PROTECTED]> > Subject: Re: Struts forms best practice > > That is a commons "toy" :-) The Struts code-base has examples of usage > in it though. The basics are quite easy: > > BeanUtils.copyProperties(dstBean, srcBean); > > If both the source and destination are of the same time I assume you meant "of the same type". That's not strictly true. For example, either the source or destination bean can be a real JavaBean, or a DynaBean with the same property names. In addition, the source "bean" can actually be a Map. Oh, and did I tell you that you can also plug in your own String->Class and Class->String converters? :-) See ConvertUtils.register(). > (or, at least, > have the same signatures on their getters/setters) you may consider using: > > PropertyUtils.copyProperties(dstBean, srcBean); > > ... since it doesn't try to do any conversions. BeanUtils will. The PropertyUtils version will run much faster because of that. > > That's you "five-second 'all you need to know to get started using > BeanUtils' tutorial" ;-) > Craig -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>