That sounds reasonable but when modifying the List object returned by calling Simple.values(), it should throw an exception since the list is essentially an immutable list and that the other APIs should be used to modify the list?
On Mon, May 11, 2009 at 10:12 AM, Staz . <[email protected]> wrote: > > >> Date: Mon, 11 May 2009 10:06:03 -0700 >> From: [email protected] >> To: [email protected] >> Subject: Re: [qi4j-dev] How to get value composites with the parent >> entity? >> >> That sounded reasonable but when taking a look again at: >> >> public interface Simple { >> String string(); >> >> List<SimpleValue> values(); >> } >> >> public interface SimpleState { >> @UseDefaults >> Property<String> string(); >> >> @UseDefaults >> Property<List<SimpleValue>> values(); >> } >> >> @Mixins ({ SimpleMixin.class }) >> public interface SimpleEntity extends Simple, EntityComposite { >> >> } >> >> Since I made the Simple interface to expose non-Property (SimpleState >> is the backing state object) methods, does it mean than that Simple's >> properties cannot be modified; sort of only getters are available. If >> I wanted Simple to be modifiable, I need to make Simple's APIs to be >> what SimpleState is? >> > > I am not sure what Rickard/Niclas would say, but to give you a quick answer > - most likely you would want add methods > > setString(String newString); > addValue(SimpleValue sv); > removeValue(SimpleValue); > > to Simple -interface. So now Simple becomes a kind of wrapper around > SimpleState. > > ________________________________ > What can you do with the new Windows Live? Find out > _______________________________________________ > qi4j-dev mailing list > [email protected] > http://lists.ops4j.org/mailman/listinfo/qi4j-dev > > _______________________________________________ qi4j-dev mailing list [email protected] http://lists.ops4j.org/mailman/listinfo/qi4j-dev

