I have a third-party bank below POJO, which we cannot provide to our customers directly.
ThirdPartyPojo.java
public class ThirdPartyPojo implements java.io.Serializable { private String name; private String ssid; private Integer id;
The above class is part of a third party jar that we use, as shown below.
ThirdPartyPojo result = someDao.getData(String id);
Now our plan is that ThirdPartyPojo is part of a third-party jar, we cannot send results like ThirdPartyPojo directly to clients. we want to create our own pojo that will have the same properties as the ThirdPartyPojo.java class ThirdPartyPojo.java . we must set the data from ThirdPartyPojo.java to OurOwnPojo.java and return it as OurOwnPojo.java below.
public OurOwnPojo getData(String id){ ThirdPartyPojo result = someDao.getData(String id) OurOwnPojo response = new OurOwnPojo(result); return response;
Now I want to find out if there is a better way to have the same properties in OurOwnPojo.java as ThirdPartyPojo.java and fill in the data from ThirdPartyPojo.java in OurOwnPojo.java and return them?
public class OurOwnPojo implements java.io.Serializable { private ThirdPartyPojo pojo; public OurOwnPojo(ThirdPartyPojo pojo){ this.pojo = pojo }
Thanks!
java java-ee-6
user755806
source share