Package org.hippoecm.frontend.model
Interface IModelReference<T>
- Type Parameters:
T
- the type of the object for the model
- All Superinterfaces:
org.apache.wicket.util.io.IClusterable
,org.apache.wicket.model.IDetachable
,IObservable
,Serializable
- All Known Implementing Classes:
ModelReference
Service interface for sharing models. When a model is shared between plugins and it is subject to change,
it should be wrapped in an IModelReference service. The service is usually available under the configuration
key 'wicket.model'.
This service is observable as well, so it is possible to receive model change events by registering an
IObserver
with the service as the observable. An IModelReference.IModelChangeEvent
should be sent whenever
setModel(org.apache.wicket.model.IModel<T>)
is invoked.
The default implementation ModelReference
, takes care of sending the events.
Model services should be registered before any of the plugins that uses them is started. This makes it easier to create plugins that consume models (they don't need to register service trackers). Since generally a model is injected into a new plugin cluster, this is usually quite a natural thing to do.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Event that's sent toIObserver
s of the service. -
Method Summary
Methods inherited from interface org.apache.wicket.model.IDetachable
detach
Methods inherited from interface org.hippoecm.frontend.model.event.IObservable
equals, hashCode, setObservationContext, startObservation, stopObservation
-
Method Details
-
getModel
org.apache.wicket.model.IModel<T> getModel()Retrieve the current model of the model service- Returns:
- the model
-
setModel
Update the model of the service. Observers will be notified with anIModelReference.IModelChangeEvent
.- Parameters:
model
- the new model
-