V - The class name of the view component from which data is read.M - The class name of the model object that is to be updated.public class ModelUpdater<V,M> extends Updater<V,M>
updater used to update JavaBean objects from
their associated UI containers.
Copyright 2006 Sans Pareil Technologies, Inc.
| Constructor and Description |
|---|
ModelUpdater(V view,
M bean)
Create a new instance with the specified UI container and java
bean.
|
| Modifier and Type | Method and Description |
|---|---|
protected String |
getFieldName(String name)
Fetch the proper bean beanField name to use based upon the view beanField
name.
|
protected void |
processCollection(Map.Entry<String,Object> entry,
Method method,
String fieldName)
Process collection fields in
Updater.bean. |
void |
update()
Update the fields of the
Updater.bean with the data in
similarly named fields in Updater.view. |
protected void |
updateField(String fieldName,
Map.Entry<String,Object> entry)
Update the corresponding beanField in the
Updater.bean with the specified
beanField name. |
beanValues, getBean, getView, setBean, setView, viewValuespublic ModelUpdater(V view, M bean)
view - The Updater.view to use.bean - The Updater.bean to use.public void update()
Updater.bean with the data in
similarly named fields in Updater.view.update in class Updater<V,M>BindingException - If errors are encountered while
accessing or setting the fields.ReflectionUtility.fetchField(java.lang.String, java.lang.Object),
ReflectionUtility.fetchMethod(java.lang.reflect.Field, java.lang.String, java.lang.Class...)protected String getFieldName(String name)
name - The view beanField name.protected void updateField(String fieldName, Map.Entry<String,Object> entry) throws IntrospectionException
Updater.bean with the specified
beanField name.fieldName - The name of the beanField in Updater.bean to update.entry - The map entry with the name and value of the associated
beanField in Updater.bean.IntrospectionException - If reflection errors occur.protected void processCollection(Map.Entry<String,Object> entry, Method method, String fieldName)
Updater.bean. Collections are usually
represented by AbstractListComponent
instances.entry - A map entry representing the name of the field in Updater.view and its value.method - The method that is to be invoked on Updater.bean.fieldName - The name of the field in Updater.bean that is being
updated.