How about: IReadableModel, IWriteableModel and IModel extending the former ? Then go all over the place and change IModel to whatever feels more appropriate.
Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Wed, Aug 20, 2014 at 2:07 PM, Martijn Dashorst < [email protected]> wrote: > I'd like to revisit this thread in the wake of Wicket 7 and beyond. > > We were toying with having RepeatingView's Item be typed as Item<? > extends T> instead of Item<T>. This would make the extensibility of > repeaters much better. This broke the hell out of the API (fixable for > the whole of Wicket in about 20 minutes), but break all applications. > > We are not sure whether making IModel a single method interface will > improve this particular use case, but it will make using Java 8's > lambda's much, much easier and cleaner. > > So I propose to revisit this discussion and see if we can find common > ground on splitting IModel into two classes: IModel<T> and > IWriteableModel<T>, and I guess there's a need for a > IReadWriteModel<T> as well for FormComponent: > > public interface IModel<T> extends IDetachable > { > public T getObject(); > } > > public interface IWriteableModel<T> extends Detachable > { > public void setObject(T); > } > > public interface IReadWriteModel<T> extends IModel<T>, IWriteableModel<T> > { > } > > For example, the IWriteableModel could be useful for FileUploadField, > except that FormComponent depends on read/write capabilities (or is > it?). > > Martijn > > > On Sun, Dec 16, 2012 at 8:30 PM, michaelmosmann <[email protected]> > wrote: > > GitHub user michaelmosmann opened a pull request: > > > > https://github.com/apache/wicket/pull/27 > > > > change IModel to readonly by default > > > > I have removed setObject() from IModel and moved it to > IWriteableModel. This time i tried to make as less impact as possible. All > test are green (you hat to disable the clirr plugin because of api changes > to 6.0.0). > > > > Why? > > > > You can not say if a model is read only by its type. You can not > force a component not to change your model value (based on the type of the > model). > > > > I would like to change this. This is a first step to show, that it > is possible. > > > > You can merge this pull request into a Git repository by running: > > > > $ git pull https://github.com/michaelmosmann/wicket > Refactor-WriteableModel > > > > Alternatively you can review and apply these changes as the patch at: > > > > https://github.com/apache/wicket/pull/27.patch > > > > ---- > > commit 5521138c412036551bdf96fcbfbe2286a7e1fd9b > > Author: Michael Mosmann <[email protected]> > > Date: 2012-09-26T20:17:26Z > > > > ignore idea project files > > > > commit 9a2f8c8665c48abe29611cc5d5f0cc72e53c961c > > Author: Michael Mosmann <[email protected]> > > Date: 2012-09-30T22:58:04Z > > > > Merge remote-tracking branch 'upstream/master' into trunk > > > > commit 698bfb771128fd157a4e5a47af5e61ff40a06d68 > > Author: Michael Mosmann <[email protected]> > > Date: 2012-10-01T17:17:46Z > > > > Merge remote-tracking branch 'upstream/master' into trunk > > > > commit b4645c4608517877aba49bac8d3aec695d8922fc > > Author: Michael Mosmann <[email protected]> > > Date: 2012-10-01T18:40:27Z > > > > git ignore > > > > commit 9323d9593931f82ac9dbe6908b49aeeda359bd31 > > Author: Michael Mosmann <[email protected]> > > Date: 2012-10-02T14:34:40Z > > > > introduce writeable model > > > > commit 5408fab49e20105c15cb9a989cf3de0845edf448 > > Author: Michael Mosmann <[email protected]> > > Date: 2012-10-09T19:32:09Z > > > > added annotation > > > > commit 2965b1b698f1c08eb07a15a60336a6e7ecce4135 > > Author: Michael Mosmann <[email protected]> > > Date: 2012-10-09T19:34:17Z > > > > Merge remote-tracking branch 'upstream/master' into trunk > > > > commit d088d97094885faa579279d2b847d6137ebfa55e > > Author: Michael Mosmann <[email protected]> > > Date: 2012-10-09T19:35:15Z > > > > Merge branch 'trunk' into Refactor-WriteableModel > > > > commit 2a60388d3513c2f44c507347b6da16d31f618860 > > Author: Michael Mosmann <[email protected]> > > Date: 2012-10-10T18:48:04Z > > > > Merge remote-tracking branch 'upstream/master' into trunk > > > > commit 5ffb19d8bf8522d19506240da8b38ff69a4707eb > > Author: Michael Mosmann <[email protected]> > > Date: 2012-12-06T21:06:17Z > > > > Merge remote-tracking branch 'upstream/master' into trunk > > > > commit 9900066c219b67b536e98fcb606e07c31076482f > > Author: Michael Mosmann <[email protected]> > > Date: 2012-12-06T21:08:38Z > > > > Merge branch 'trunk' into Refactor-WriteableModel > > > > commit 5e2c00f1f3c1988ed250793ca55768c8fcf1bbac > > Author: Michael Mosmann <[email protected]> > > Date: 2012-12-16T18:05:24Z > > > > Merge remote-tracking branch 'upstream/master' into trunk > > > > commit 575d73af0c57611e17cd5e68fff61a3a5cd3c50d > > Author: Michael Mosmann <[email protected]> > > Date: 2012-12-16T18:07:53Z > > > > Merge remote-tracking branch 'origin/trunk' into > Refactor-WriteableModel > > > > commit 74dccf0c42af29dfbc49d31c1d7330a43ebba6c6 > > Author: Michael Mosmann <[email protected]> > > Date: 2012-12-16T18:30:46Z > > > > prepare component model replacement > > > > commit 49dc93c8b81c913a37dfe92fedbe0cf81e720413 > > Author: Michael Mosmann <[email protected]> > > Date: 2012-12-16T19:01:01Z > > > > compiles > > > > commit 23f85a8dd42a5b9838774195f88e3b3f74785a40 > > Author: Michael Mosmann <[email protected]> > > Date: 2012-12-16T19:19:11Z > > > > clean up > > > > commit 8b93bc61bf83b1dc681c6d71f1ea8b8d43c7c1ab > > Author: Michael Mosmann <[email protected]> > > Date: 2012-12-16T19:19:19Z > > > > clean up > > > > ---- > > > > > > -- > Become a Wicket expert, learn from the best: http://wicketinaction.com >
