I have an application with many Value Objects.
In many cases I want a convert from an Entity to a Value Object. Usually I have an Adapter for each scenario for example LanguageEntity to Locale and so on, from Locale to LanguageEntity.
However I don't like the naming currently because:
First of all I dont like to have Adapter that do both ways.. I have LanguageAdapter and LocaleAdapter... both called Adapter .. but one makes Language from Locale and another makes Locale from Languge..
What I like even less.. is th real question: I have many classes that uses the "adapters" but do not adapt.. for example I need a Article but only Title + Language in one case, in another I need Keywords + Title for 2 Languages and so on so I have a Configurable classes that I call "Setters" that I say what I want to be "set" and they use the right set of Adapters to set the right fields using the adapters. All of them are of type void and they do not return anything. They look like :
class ArticleSetter<SOURCE,TARGET> {
void setup(SetterOptions options) {...}
void perform(SOURCE source, TARGET target) {... }
}
Where based on the SetterOptions will lookup for the right adapters that will adapt only this fields and will return the partially "set" object.
So I need an advice about the naming ... Adapters + Setters - the current situation is not very clever.
Aucun commentaire:
Enregistrer un commentaire