This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
You could write two static methods to convert one to the other, but you would have to describe the classes in terms of the package and not import them.
E.g. for two classes of the same name in different packages.
You could have...
If your WrapperClass2 exists twice in different packages you will have to write another method for that one and use it.
I don't know of an easier method except having one class in one package instead of duplicating it.
Hope this helps.
Cameron "EvilGeek" Miller
Joined: Mar 05, 2007
Thanks for reply.
If I use convert mechanisum I have to write a lot code because inside class has atleast10-15 other class object and that class also holding another class object.
I am consuming one external web service and published internal web service. Internal web service has same structure as external wsdl. when other application call my internal service I need to convert those object to external web service object and call the external web service operation.
Take a look at these methods, they would surely minimize code lines, but I would exercise caution (I never used them before in a production environment). They both seem to do a shallow copy of the origin's bean properties, most probably using reflection.