Our problem is, our service GET /services/v1/myobject
returns object named Xyz
. This representation is used by multiple existing clients.
The new service GET /services/v2/myobject
needs to expose exact same object but with different name, say XyzLmn
Now one obvious solution would be to create two classes Xyz
and XyzLmn
, then copy Xyz
into XyzLmn
and expose XyzLmn
in the v2
.
What I am looking for is, how can I keep the same java pojo class Xyz
and conditionally serialize it to either XyzLmn
or Xyz
?