I have two objects with name Site and AppSite, both has same fields like below. Is there any util class to copy all the fields from AppSite to Site, like BeanUtils.copyProperties.
public class AmsSite implements Serializable{
private long siteId;
private String name;
private String routingId;
private String siteType;
private List<AmsPlatform> platforms;
private List<AmsProvider> providers;
public class Site implements Serializable{
private long siteId;
private String name;
private String routingId;
private String siteType;
private List<Platform> platforms;
private List<Provider> providers;
If you see in above two pojo, i have two list of object fields. Both that object also same like Site and AmsSite object only. Has same field name but different class name.
BeanUtils.copyProperties is copying all the literal field values from AppSite to Site properly, but not the inner object. (I mean deep copy is not happening). I saw Serialization.clone in apache common lang works for deep copy, but that works only if we have same class name. My case is bit different same field name but different class name.