So I have a POJO class let´s call it: InnerDomainObject. Then I have an object representing this object, with a few more fields, for communication towards different clients (it s an API DTO): OuterDomainObject
Because the DTO has in fact all of the POJOs fields, I made OuterDomainObject inherit from InnerDomainObject.
Now I need to somehow cast InnerDomainObject to OuterDomainObject --> not possible.
I want to avoid writing a constructor iterating through all the fields. I want to avoid writing useless code.
I just want OuterDomainObject to be created out of InnerDomainOBject´s values and then add some to it before sending it to the client.
What´s the best way of doing this ?