On 2009-12-29 12.16, Alex Shneyderman wrote:
What's the difference between newInstance and prototype methods on TransientBuilder? I am a bit confused It seems like prototype does create an instance that I can modify; do I still have to call newInstance after I initialized all the things that I wanted to initialize?Is this the correct way to do it: TransientBuilder<QrmTableMapping> bldrQTM = module.transientBuilderFactory().newTransientBuilder( QrmTableMapping.class ); QrmTableMapping prototype = bldrQTM.prototype(); result.originator().set( entityDescriptor ); .... return bldrQTM.newInstance(); If it is, I gotta say it is confusing. I would think an initializing callback as a parameter to newInstance() would make things a lot more clear.
One difference between the prototype and the real instance is that non-optional properties may be null in the prototype, but not in the real instance. Also, if you reuse the builder you'll get the same prototype instance every time, so you don't want to return that from your code for others to use (e.g. don't do "return bldrQTM.prototype();").
How would the initializing callback thing work? Can you provide a short example?
/Rickard _______________________________________________ qi4j-dev mailing list [email protected] http://lists.ops4j.org/mailman/listinfo/qi4j-dev

