You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by James Strachan <ja...@yahoo.co.uk> on 2002/05/16 18:00:19 UTC

[beanutils] making BeanUtils.setProperty() public

For some reason the very useful BeanUtils.setProperty(bean, property, value)
method is private. Does anyone have any objections to making it public?

Creating a Map and filling it with one property/value pair so that
BeanUtils.populate() can be called seems a tad inefficient if someone only
wants to set one property, using the same conversion rules as
BeanUtils.populate().

James


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [beanutils] making BeanUtils.setProperty() public

Posted by James Strachan <ja...@yahoo.co.uk>.
From: "Craig R. McClanahan" <cr...@apache.org>
> On Thu, 16 May 2002, James Strachan wrote:
>
> > Date: Thu, 16 May 2002 17:00:19 +0100
> > From: James Strachan <ja...@yahoo.co.uk>
> >
> > For some reason the very useful BeanUtils.setProperty(bean, property,
value)
> > method is private. Does anyone have any objections to making it public?
> >
>
> It was originally private because I just factored out a bunch of code that
> was in two places in BeanUtils.populate().  I guess it is sorta useful on
> its own, because it does the automatic conversions for you.  Go for it.

Cool, thanks Craig. Its now public in CVS.

James


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [beanutils] making BeanUtils.setProperty() public

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Thu, 16 May 2002, James Strachan wrote:

> Date: Thu, 16 May 2002 17:00:19 +0100
> From: James Strachan <ja...@yahoo.co.uk>
> Reply-To: Jakarta Commons Developers List <co...@jakarta.apache.org>
> To: Jakarta Commons Developers <co...@jakarta.apache.org>
> Subject: [beanutils] making BeanUtils.setProperty() public
>
> For some reason the very useful BeanUtils.setProperty(bean, property, value)
> method is private. Does anyone have any objections to making it public?
>

It was originally private because I just factored out a bunch of code that
was in two places in BeanUtils.populate().  I guess it is sorta useful on
its own, because it does the automatic conversions for you.  Go for it.

> Creating a Map and filling it with one property/value pair so that
> BeanUtils.populate() can be called seems a tad inefficient if someone only
> wants to set one property, using the same conversion rules as
> BeanUtils.populate().
>
> James

Craig


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [beanutils] making BeanUtils.setProperty() public

Posted by James Strachan <ja...@yahoo.co.uk>.
From: "James Mitchell" <jm...@telocity.com>
> Did you ever get your answer on this?

I did; have made it public with Craig's blessing.

> I could be wrong, but I think it should be
PropertyUtils.setProperty(Object
> bean, String name, Object value)

That method works and is indeed public but it does not have the default type
conversions that the BeanUtils.setProperty() method does. So now if folks
want the behaviour of PropertyUtils.setProperty() with type conversions,
they can use BeanUtils.setProperty().

James


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: [beanutils] making BeanUtils.setProperty() public

Posted by James Mitchell <jm...@telocity.com>.
Did you ever get your answer on this?

I could be wrong, but I think it should be PropertyUtils.setProperty(Object
bean, String name, Object value)

JM

> -----Original Message-----
> From: James Strachan [mailto:james_strachan@yahoo.co.uk]
> Sent: Thursday, May 16, 2002 12:00 PM
> To: Jakarta Commons Developers
> Subject: [beanutils] making BeanUtils.setProperty() public
>
>
> For some reason the very useful BeanUtils.setProperty(bean,
> property, value)
> method is private. Does anyone have any objections to making it public?
>
> Creating a Map and filling it with one property/value pair so that
> BeanUtils.populate() can be called seems a tad inefficient if someone only
> wants to set one property, using the same conversion rules as
> BeanUtils.populate().
>
> James
>
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>