I would like to copy the properties of an object to another, only if they are not null and exist in the target object.
I know BeanUtils.copyProperties but it doesn't exactly suit the need.
What totally suit is the jquery.extend function. Is there an equivalent in the Java libraries/frameworks ? (or else I'll write my own...)
For example, the destination object is User, and the origin is UserSettings :
User UserSettings User
fisrtName="Rick" firstName=null fisrtName="Rick"
lastName="Dangerous" extends lastName="newLastName" gives lastName="newLastName"
nickName="RD" nickName="RD"
EDIT
Finally I wrote my own method, if anyone is interested see https://gist.github.com/1602045
.clone()method? you should be able to callobj.clone()and it will return cloned objectextendsimply doesn't (or better "shouldn't") apply to Java. Can you give an example of the code and the classes you are using? And explain why you think yo need ´extend`.Map?