Package net.sf.jguiraffe.gui.forms.bind
Class BeanBindingStrategy
- java.lang.Object
-
- net.sf.jguiraffe.gui.forms.bind.BeanBindingStrategy
-
- All Implemented Interfaces:
BindingStrategy
public class BeanBindingStrategy extends Object implements BindingStrategy
An implementation of the
BindingStrategy
interface that operates on Java beans.This implementation uses Commons Beanutils for reading and writing properties of Java bean components. The names of form fields are mapped to corresponding names of bean properties. That way data exchange can be performed in both directions.
- Version:
- $Id: BeanBindingStrategy.java 205 2012-01-29 18:29:57Z oheger $
- Author:
- Oliver Heger
-
-
Constructor Summary
Constructors Constructor Description BeanBindingStrategy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
readProperty(Object model, String propertyName)
Reads a property from a model object.void
writeProperty(Object model, String propertyName, Object value)
Writes a property to a model object.
-
-
-
Method Detail
-
readProperty
public Object readProperty(Object model, String propertyName)
Reads a property from a model object. All exceptions related to reflection are re-thrown asFormRuntimeException
.- Specified by:
readProperty
in interfaceBindingStrategy
- Parameters:
model
- the model objectpropertyName
- the name of the property to read- Returns:
- the value of this property
- Throws:
FormRuntimeException
- if an exception occurs
-
writeProperty
public void writeProperty(Object model, String propertyName, Object value)
Writes a property to a model object. All exceptions related to reflection are re-thrown asFormRuntimeException
.- Specified by:
writeProperty
in interfaceBindingStrategy
- Parameters:
model
- the model objectpropertyName
- the name of the property to readvalue
- the new value of this property- Throws:
FormRuntimeException
- if an exception occurs
-
-