Steve Lowery created WICKET-5312: ------------------------------------ Summary: Add detachModel(IModel<?> model) to Component Key: WICKET-5312 URL: https://issues.apache.org/jira/browse/WICKET-5312 Project: Wicket Issue Type: Improvement Components: wicket Environment: Any Reporter: Steve Lowery Priority: Minor
Can you add the following method (or something similar) to Component to avoid a lot of boilerplate code when a Component has more than one model object? We have many components that take more than one model object and we are responsible for detaching all but the one passed into super. If those others are optional, we have to null check them before detaching. Would be nice if wicket did this for us... protected final void detachModel(IModel<?> model) { if(model != null) { model.detach(); } } Without a convenience method, our code looks like this... @Override protected void onDetach() { if(modelOne != null) { modelOne.detach(); } if(modelTwo != null) { modelTwo.detach(); } ... } -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira