public class ResourceModel extends AbstractReadOnlyModel<String> implements IComponentAssignedModel<String>
StringResourceModel
. It lacks parameter substitutions, but is generally easier to use.
If you don't use this model as primary component model (you don't specify it in component
constructor and don't assign it to component using Component.setDefaultModel(IModel)
),
you will need to connect the model with a component using wrapOnAssignment(Component)
.
Constructor and Description |
---|
ResourceModel(String resourceKey)
Constructor
|
ResourceModel(String resourceKey,
IModel<String> defaultValue) |
ResourceModel(String resourceKey,
String defaultValue)
Constructor
|
Modifier and Type | Method and Description |
---|---|
String |
getObject()
Gets the model object.
|
IWrapModel<String> |
wrapOnAssignment(Component component)
This method is called when the component gets its model assigned.
|
detach, setObject, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
detach
public ResourceModel(String resourceKey)
resourceKey
- key of the resource this model representspublic ResourceModel(String resourceKey, String defaultValue)
resourceKey
- key of the resource this model representsdefaultValue
- value that will be returned if resource does not existpublic String getObject()
IModel
getObject
in interface IModel<String>
getObject
in class AbstractReadOnlyModel<String>
AbstractReadOnlyModel.getObject()
public IWrapModel<String> wrapOnAssignment(Component component)
IComponentAssignedModel
wrapOnAssignment
in interface IComponentAssignedModel<String>
IComponentAssignedModel.wrapOnAssignment(org.apache.wicket.Component)
Copyright © 2006–2021 Apache Software Foundation. All rights reserved.