> >> IIRC, what you ask for already exist in several forms in Qi4j. On one
> >> hand you can place the mutable and immutable methods in separate
> >> interfaces and pass one or the other (or "both") around. The other way
> >> is the brand new feature of 'multiple types for entities', which
> >> allows more than one interface per Entity instance.

Hmm, I succeeded in two separate interfaces -way. How does the other way work? 
How can I change type of entity without creating a new one? After digging 
around a little, I managed to do it with

EntityInstance.getEntityInstance(this._meAsEntity).newProxy(myImmutableRole.class);

But I got a feeling that's not exactly how it's meant to be done. :)

> For an EntityComposite, it is not possible to cast the types, although
> it would be possible for the client to extract the Identity and
> retrieve it directly.
> 
> Also, (unless Rickard have made changes) if you have a CompositeA
> extends A,B,Composite and you use
> B b = factory.newComposite( B.class );
> 
> then the returned instance can not be cast to A.
> 

I've tested this and it seems to work like you said.

_________________________________________________________________
Invite your mail contacts to join your friends list with Windows Live Spaces. 
It's easy!
http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us
_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to