Using Apache Wicket 7. Which model should be used in a Form? The default model of the component or the model of the form itself?
The only difference is that getModel()
is typesafe, but they both return the same object.
Here's the 7.0.0 implementation of Form.getModel()
for example:
@Override
@SuppressWarnings("unchecked")
public final IModel<T> getModel()
{
return (IModel<T>)getDefaultModel();
}
This all goes back to the Wicket 1.3 -> 1.4 transition, which introduced generics into Wicket, and the design decision was to rename the old getModel()
method to getDefaultModel()
and redefine getModel()
in certain components to use the type parameter of that component.
Long story short: just use getModel()
wherever possible.
This is unrelated to the choice of whether you use individual component models, or one big model for the form.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments