I have a class named as order in package com.abc
I have another class named as order in different package in different project named as com.bcd
Both order classes have same code get, set functions and variables with no changes.
Then I have objects
com.abc.order obj1 = new com.abc.order();
com.bcd.order obj2 = new com.bdc.order();
Now I have to pass arguments to a function and it takes only obj2 as parameters
How can I convert type of obj1 into type of obj2
I cannot change parameters for the function.
Looking forward to your reply.
thanks.
Have a look at Apache Commons BeanUtils to copy properties from one object to another.
http://commons.apache.org/beanutils/v1.8.3/apidocs/index.html
Something like
should do the trick.