I have to systems:
- System A is a legacy system and cant be programmed
- System B has to consume objects from System A via REST
System A has the superclass Customer and the subclasses Private Customer, Business Customer and Government Customer. Each of the subclasses inherit basic attributes from Customer and extends the their own attributes.
System A sends a Customer as JSON to System B. System B doesnt know if the JSON is a Private Customer, Business Customer or a Government Customer. But it needs to create Java Objects out of them into the right kind of Customer.
One solution could be to make a case destinction. If class specific attributes are present or not. But none of the values are obligatory. Plus, I want some sort of blueprint and creating such specific case destinctions are not a good programming design.
Is there a best practice for that?