vendredi 31 janvier 2020

is there any way to invoke different classes (which have different types of input and output) from a common class

I have a unique issue. I am building a spring boot app from where i need to invoke different types of rest api urls based on a parameter from client. Each of these api could have different input and output but there invocation would be based on a single parameter which i will receive as a parameter. I am thinking of creating separate operation classes for these separate apis under a common interface. And i will create a factory using factory design pattern and will create object of one of these operation classes from this factory class using input parameter value as decision making value. But as input and out could be different for different apis , i should have a mapper class which can map input and output from these api and can represent a common input and out.

But if i create a single mapper class for all of these operation classes, each time we introduce a new rest api to call from our app, we are going to have a new operation class so we need to modify this mapper class as well. this is where i am stuck. I am not able to find solution for this. Is there any design pattern which i can use here or can spring boot come to rescue?

Aucun commentaire:

Enregistrer un commentaire