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. 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

