API / Apache Wicket Interview questions
What is an IModel in Wicket?
IModel<T> is Wicket's abstraction for wrapping the data a component displays or edits, decoupling a component from exactly where that data lives or how it's fetched.
Instead of a component holding a raw object reference directly, it holds an IModel<T> whose getObject() method is called whenever the component needs the current value, and whose setObject() is called when a form writes a new value back. That indirection is what lets Wicket implement things like detachable models, which don't keep a heavyweight object (say, a full database entity) sitting in the session between requests — instead they re-fetch it lazily when getObject() is next called, then clear the reference again in detach().
Common built-in implementations include Model (a simple wrapper around a serializable value), PropertyModel (reads/writes a named property via reflection), and LoadableDetachableModel (re-loads its value from a data source on demand rather than keeping it resident).
More Related questions...