You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by miro <mi...@yahoo.com> on 2008/10/13 20:25:38 UTC

beanutils copy to ignore null properties

I have Bean Test
with properties   A and B

An instance of  Test  TestA has value for A   and B is null.
another intance of Test  TestB  has value for B and A is null .
now  when I call copyProperties BeanUtils.copyProperties(TestA, TestB)
TestA 
  property A will get null 
and Propetrty B will be B

instead I want beanUtils to update TestA      just by copying non null
properties is it possible ?

 
-- 
View this message in context: http://www.nabble.com/beanutils-copy---to-ignore-null-properties-tp19960177p19960177.html
Sent from the Commons - User mailing list archive at Nabble.com.


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


Re: beanutils copy to ignore null properties

Posted by Niall Pemberton <ni...@gmail.com>.
On Mon, Oct 13, 2008 at 7:25 PM, miro <mi...@yahoo.com> wrote:
>
> I have Bean Test
> with properties   A and B
>
> An instance of  Test  TestA has value for A   and B is null.
> another intance of Test  TestB  has value for B and A is null .
> now  when I call copyProperties BeanUtils.copyProperties(TestA, TestB)
> TestA
>  property A will get null
> and Propetrty B will be B
>
> instead I want beanUtils to update TestA      just by copying non null
> properties is it possible ?

This isn't provided by BeanUtils, but you could use BeanUtils to build
this kind of *merge" functionality.

Niall

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