On Thu, Feb 19, 2009 at 6:04 PM, Rickard Öberg <[email protected]> wrote: > Hey, > > Now that we have Values, and they're all Immutable and such goodness, I > think it is important to make it easy to mutate them! Currently one has > to locate a ValueBuilderFactory and do: > SomeValue someInstance = ...; > ValueBuilder<SomeValue> builder = > vbf.newValueBuilder(SomeValue.class).withPrototype(someInstance); > builder.prototype().someProperty().set("New value"); > someInstance = builder.newInstance(); > > I suggest that we add a method to ValueComposite so that one can do this > directly: > SomeValue someInstance = ...; > ValueBuilder<SomeValue> builder = someInstance.buildWith(); > builder.prototype().other().set("New value"); > someInstance = builder.newInstance(); > --- > Short and to the point, and the only thing you need as a client is the > value instance you want to change.
Ok, good convenience here. What about "visibility" ?? Will the ValueBuilder be chosen with the visibility of the ValueComposite being mutated, or the client doing the action? The former sounds more correct or at least intuitive, but are we then not "leaking concerns" ?? Cheers Niclas -- http://www.qi4j.org - New Energy for Java _______________________________________________ qi4j-dev mailing list [email protected] http://lists.ops4j.org/mailman/listinfo/qi4j-dev

