There is then an interesting "side problem"...
See ObjectBuilderFactoryTest, the following class could then be
created by a 'created' anyObject in the second constructor, instead of
with the first constructor.
I am not sure how we are going to define the exact and predictable
semantics here... I'll wait for Rickard's thoughts, and meanwhile
commit the cleaned up 'develop' branch.
public static final class ManyConstructorObject
{
AnyObject anyObject;
Module module;
public ManyConstructorObject( @Structure Module module )
{
this.module = module;
}
public ManyConstructorObject( @Uses AnyObject anyObject,
@Structure Module module )
{
this.anyObject = anyObject;
this.module = module;
}
}
On Fri, Sep 23, 2011 at 4:21 PM, Paul Merlin <[email protected]> wrote:
> On Fri, 23 Sep 2011 14:04:34 +0800, Niclas Hedhman wrote:
>>
>> Gang,
>>
>> In 1.x, it seems that there were many (all?) cases where if no use()
>> was given in the builders, the construction of the object (transient?)
>> would fail. In 2.0, the current code will create a new object on the
>> fly if it can. For instance;
>>
>> public class A
>> {
>> @Uses B b;
>> }
>>
>> public class B
>> {
>> // default constructor
>> }
>>
>> Then if one do;
>>
>> A anObject = module.newObject( A.class );
>>
>> this will not fail. In 1.x it would, since no use() is given.
>>
>>
>> So the question is; Which one is the correct behavior? Explicit use()
>> declarations or on-the-fly-creation-if-possible?
>
> I like the idea of on-the-fly-creation-if-possible. IMO it will ease the
> pain when working with graphs of objects. Anyway runtime still respect
> assembly
> and visibility.
>
> My 2 cents.
>
> /Paul
>
> --
> Paul Merlin - eskatos.github.com
>
> _______________________________________________
> qi4j-dev mailing list
> [email protected]
> http://lists.ops4j.org/mailman/listinfo/qi4j-dev
>
--
Niclas Hedhman, Software Developer
http://www.qi4j.org - New Energy for Java
I live here; http://tinyurl.com/3xugrbk
I work here; http://tinyurl.com/24svnvk
I relax here; http://tinyurl.com/2cgsug
_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev