aspose file tools*
The moose likes Other Open Source Projects and the fly likes BeanUtils and null-properties. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "BeanUtils and null-properties." Watch "BeanUtils and null-properties." New topic
Author

BeanUtils and null-properties.

Grigory O. Ptashko
Greenhorn

Joined: Jan 26, 2006
Posts: 16
Hello.

I try to use BeanUtils from commons project. I want to copy properties from one bean to another. The problem I have is when the source bean has a java.lang.String property which is null and the target bean has property of java.lang.Long. Using BeanUtils.copyProperties(target, source) set the target's property to 0 (zero). But I do not need this. I need the property to stay null also as in the source bean.

Here is the sample code:

Source bean:


Target Bean:


And the code:



Gives the following output:



Any ideas?

Thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: BeanUtils and null-properties.