On Thu, Dec 31, 2009 at 3:01 AM, Alex Shneyderman
<[email protected]> wrote:
>> And the follow-up would be; What about the private mixins? I'm
>> seriously curious.
>
> Could you explain what you foresee as the problem with private
> mixins? I might have run into the limits of my understanding what
> private mixins are here.

Ok, let's start with what Private Mixins are; Mixins not visible thru
the Composite Type interface.

Example;

@Mixins( AbcMixin.class )
public interface AbcComposite extends Abc, TransientComposite
{}

public interface Def
{
    Property<String> something():
}

public class AbcMixin implements Abc
{
    @This
    private Def def;

:
}


The "def" instance is not visible in the AbcComposite interface, and
can not be obtained outside the composite itself (well, some serious
reflection probably can).

So, on creation, you need to initialize "something()", and that is
done like this;

TransientBuilder<Abc> tb = tbf.newTransientBuilder( Abc.class );
Def defProto = tb.prototypeFor( Def.class );
defProto.something().set( "Niclas" );
Abc instance = tb.newInstance();


So, the prototype() method is actually a convenience method for
prototypeFor( Class<T> compositeType ). And it is allowed to have any
number of private mixins hidden from external view/manipulation.


Cheers
-- 
Niclas Hedhman, Software Developer
http://www.qi4j.org - New Energy for Java

I  live here; http://tinyurl.com/2qq9er
I  work here; http://tinyurl.com/2ymelc
I relax here; http://tinyurl.com/2cgsug

_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to