Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added migration assistant for StringResourceModel

...

  • since the parameters argument type is Object..., i.e. varargs, it was hard for the compiler and runtime to differentiate the "defaultValue" from the "parameters"
  • it wasn't possible to use lazy evaluation of the default value

If in your application you have code like:

Code Block
titleMyComponent.java
borderStylesolid
StringResourceModel model = new StringResourceModel(resourceKey, model, "Some default value", new Object[] [param1, param2]);

then the simplest solution is to use Model.of("Some default value"):

...

titleMyComponent.java
borderStylesolid

...

  • the amount of parameters for StringResourceModel resulted in rather cryptic code indecipherable for mere mortals.

So we opted to remove most of the constructors of StringResourceModel and use a fluent API instead. For ease of migration you can use the StringResourceModelMigration class to alleviate the pain of figuring out the right way to construct your instance using the new fluent API.

Change the new StringResourceModel(...) constructor call to an invocation of StringResourceModelMigration.of(...), and then perform the Inline Method refactoring of your IDE.

 

org.apache.wicket.extensions.validation.validator.+Xyz+Validator#decorate() now works with IValidationError WICKET-5174

...