> Date: Tue, 12 May 2009 18:51:16 +0200
> From: [email protected]
> To: [email protected]
> Subject: Re: [qi4j-dev] Pattern for modeling Roles, State, Entities
> 
> On Tue, May 12, 2009 at 6:29 PM, Staz . <[email protected]> wrote:
> >> 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.
> >
> > But if I have a composite, which implements both immutable and mutable
> > interfaces, and then it is passed around as immutable interface, it is
> > possible for client to cast it into mutable interface, and then use methods
> > of that interace to change state. So it must be two different composites
> > which implement mutable and immutable interfaces.
> 
> 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.
> 

Weird, I remember testing that week or two ago, and it worked. Although, I 
don't remember exactly, did I use B.class or CompositeA.class in the builder 
creator factory. The codebase was month old or so anyway.
But if what you say is true, then the system is not as simple as I thought and 
it changes things. Once again, time to think about it and digest it. Thanks for 
tip. :)

_________________________________________________________________
Drag n’ drop—Get easy photo sharing with Windows Live™ Photos.

http://www.microsoft.com/windows/windowslive/products/photos.aspx
_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to