jeudi 28 mars 2019

Different represent of object

We have a requirement to represent a base POJO class into different representations.

We are thinking to go with decorator design pattern

Base class Person

class Person {
  String fName;
  String lName;
}


Should be represented into another format for example wherein class P we want to represent fName and lName of Person as a name in class P. There could many more representations. Here I am giving one of them.

class P {
  String name;
}

Need opinion what is best-suited design for such requirement, should we go with model converters?

P Converter.convertToPFromPerson(){
  ...
}

Aucun commentaire:

Enregistrer un commentaire