Sounds like a good idea. We have a special I18N class in our app specifically as a wrapper around StringResourceModel.
Martijn On Wed, May 13, 2015 at 11:29 PM, Guillaume Smet <[email protected]> wrote: > I gave it some more thoughts and I admit it's a bit radical but I think we > should simply remove all these constructors and give StringResourceModel a > fluid interface. > > We could keep 2 constructors: > StringResourceModel(final String resourceKey, final Component component) > StringResourceModel(final String resourceKey) > > and add the following methods: > setDefaultValue > setModel > setParameters > all these methods returning 'this'. > > We often call the constructors with null values for some of these > parameters anyway and it would be far more readable and less error prone. > > When I upgrade, I really prefer having compilation errors rather than code > silently failing (currently it might not take the default value and it > might get an off by one error for the parameters). > > Thoughts? > > On Wed, May 13, 2015 at 1:44 PM, Guillaume Smet <[email protected]> > wrote: > >> Yup, that's exactly the issue I had. >> >> It's not hard to fix in user code. The hard part is to find the >> occurrences of the issue in the code. >> >> >> On Wed, May 13, 2015 at 8:05 AM, Martin Grigorov <[email protected]> >> wrote: >> >>> https://issues.apache.org/jira/browse/WICKET-5906 sounds related. >>> >>> Martin Grigorov >>> Wicket Training and Consulting >>> https://twitter.com/mtgrigorov >>> >>> On Mon, May 11, 2015 at 11:26 PM, Guillaume Smet < >>> [email protected]> >>> wrote: >>> >>> > Hi, >>> > >>> > Still working on the migration to 7. >>> > >>> > We used this pattern with Wicket 6: >>> > new StringResourceModel(propertyModel.getObject(), null, >>> > propertyModel.getObject(), objectModel, secondaryObjectModel)) >>> > which was directed to the following constructor: >>> > StringResourceModel(key, model, defaultValue, Object... parameters) >>> > >>> > When migrating to 7, this pattern is silently directed to the following >>> > constructor: >>> > StringResourceModel(key, model, Object... parameters) >>> > thus the replacements are wrong. >>> > >>> > The fact that our application is silently broken is kinda annoying. >>> > >>> > I ended up moving to: >>> > new StringResourceModel(propertyModel.getObject(), (IModel<?>) null, >>> > propertyModel, new Object[] { objectModel, secondaryObjectModel })) >>> > >>> > I don't know if there is something to do about it but I thought I might >>> as >>> > well get it out here. >>> > >>> > -- >>> > Guillaume >>> > >>> >> >> -- Become a Wicket expert, learn from the best: http://wicketinaction.com
