Hi,

what Do you think about a single point of rich object creation in the 
appropriate object repository like:

RichPersonRepositoryImplBase:

public RichPerson createFrom(Person domain) {
     RichPerson richPerson = richPersonFactory.create();
     richPerson.fromModel(domain);
     return richPerson;
}

So we have one single method to create objects, which could be used 
e.g. from RichPersonRepositoryImpl to transform person objects retrieved 
from other PersonService methods without the need to get/inject the 
personFactory.

In the referenced rich objects, which contains reference holder like:

    public RichPerson getCaller() {
         if (callerHolder != null) {
             return callerHolder.get();
         }

         populate();
         callerHolder = new AtomicReference<RichPerson>();
         if (populated != null) {
             if (populated.getCaller() != null) {
                 callerHolder.set(richCallerFactory.create());
                 callerHolder.get().fromModel(populated.getCaller());
             }
         }
         return callerHolder.get();
     }

this could be changed to call the createFromModel()-method. Therefore we 
must inject repositories into other repositories, which is more 
symmetric to the backend stuff.

What do you think of it?

regards

------------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It is the best place to buy or sell services for
just about anything Open Source.
http://p.sf.net/sfu/Xq1LFB
_______________________________________________
Fornax-developer mailing list
Fornax-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fornax-developer

Reply via email to