vendredi 14 septembre 2018

Which OO design to use when there is a limitation from a third-party system?

Imagine this cenario: A Customer object that is provided by a third-party system which have multiple properties related to phone numbers.

public class Customer {

    private String phoneAreaCode;
    private String phoneNumber;

}

Another third-party system which receive his own Customer object which have a Phone object inside it.

public class XCustomer {

    private Phone phone;

}

I would like to know if there is a OO design pattern to convert the Customer to XCustomer. Should one of the Customers know about the other Customer object and convert the phone properties into a Phone object? Should I create utility classes to convert one into another? Or there is a better solution?

Aucun commentaire:

Enregistrer un commentaire