T - The Model object typepublic class PropertyModel<T> extends AbstractPropertyModel<T>
public class Person
{
private String name;
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
}
We could construct a label that dynamically fetches the name property of the given person object
like this:
Person person = getSomePerson();
...
add(new Label("myLabel", new PropertyModel(person, "name"));
Where 'myLabel' is the name of the component, and 'name' is the property expression to get the
name property.
add(new TextField("myTextField", new PropertyModel(person, "name"));
LoadableDetachableModel,
Serialized Form| Constructor and Description |
|---|
PropertyModel(Object modelObject,
String expression)
Construct with a wrapped (IModel) or unwrapped (non-IModel) object and a property expression
that works on the given model.
|
| Modifier and Type | Method and Description |
|---|---|
static <Z> PropertyModel<Z> |
of(Object parent,
String property)
Type-infering factory method.
|
protected String |
propertyExpression() |
String |
toString() |
getInnermostModelOrObject, getObject, getObjectClass, getPropertyExpression, getPropertyField, getPropertyGetter, getPropertySetter, setObjectattach, detach, getChainedModel, getTarget, setChainedModel, setTargetpublic PropertyModel(Object modelObject, String expression)
modelObject - The model object, which may or may not implement IModelexpression - Property expression for property accesspublic static <Z> PropertyModel<Z> of(Object parent, String property)
Z - the generic typeparent - object that contains the propertyproperty - property pathPropertyModel instanceprotected String propertyExpression()
propertyExpression in class AbstractPropertyModel<T>public String toString()
toString in class ChainingModel<T>Copyright © 2015–2017 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.