I found no other way to implement a switch case to cast objects on both sides to solve my problem.
Basically I need to send objects over a network protocol based on XML, the object is sent inside XML
converted in base64, overall encoding of XML is utf-8.
Let's suppose in my network there are 2 peers connected via socket.
I have multiple instances of different types on both peers but I want to keep these instances
synchronized. If something changes on side A, side B must receive that instance and replace
it in the correct place (just one way, from A to B).
When I receive such instance on B I want to cast it to it's proper instance
of it's proper type and I am scratching my head on how could I implement this without some
sort of unique ID table and switch case.
If I had 1 instance per type could it be done easily?
But I need to keep in synch many instances per type.
Is there any dynamic casting that I can trigger based on some type/instanceID information
I could send along the object?