I have a brief question. Recently i came across with a builder pattern that intrigued me.
So, i have an EntityBuilder which builds an Entity, but it doesn't return the entity. Here is the method signature:
public void build();
Instead, inside the build method, it delivers the new object created, the Entity, to a CacheImplementation instance to store it. Note: the CacheImpl is injected in the builder's constructor.
public void build(){
//create new entity
cacheImplementation.add(entity);
}
Does this sounds like best practice?
Thanks, Vlad
Aucun commentaire:
Enregistrer un commentaire