I have an object that contains several dozens of properties. A portion of property values come from Service A, others from Service B, and the remaining from Service C. This object is a flat model that is used to be serialized as a request REST call to another external service.
If I define the service APIs to accept the same object, then I can write something like:
Object: MyModel
Service A's API: MyModel getAProperties(MyModel mm)
Service B's API: MyModel getBProperties(MyModel mm)
Service C's API: MyModel getCProperties(MyModel mm)
Each API returns the same reference that is passed to its signature (see above):
MyModel mm = new MyModel()
serviceA.getAProperties(mm);
ServiceB.getBProperties(mm);
ServiceC.getCProperties(mm);
I am trying to see if there is an already established design pattern that provides a more elegant solution to this.