I am having a Java bean, which i want to clone it to get a new instance, but in the new instance, I want few of the properties to have values, others i don't want to be cloned/copied.
Example:-
Source:- Class ABC, Object src --> field1 = 10, field2 =5, field3 = 6, field4 = 20
Target:- Class ABC, Oject clone --> field1 = 10, field2 = 5, field3 = null, field4 = null
I can also use copyProperties
but than, I have to create a similar but small class structure.
I can also use copyProperty
but then, I have to write it multiple times.
Is there a good solution to this.