samedi 8 avril 2017

The correct way of creating a Factory for creating domain objects

The following is the code from my service layer

@Override public Boolean saveTransportation(SaveTransportationCommand addServiceCommand) { return getServiceAgreementDao().saveTransportation((List)ServiceAgreementFactory.get(addServiceCommand)); }

So here I am trying to create my domain objects from some Command object, can I do validations and set values from command in Factory, is my approach correct, Or should I user Factory for only creating objects.

Aucun commentaire:

Enregistrer un commentaire