com.sptci.echo2
Class Updater

java.lang.Object
  extended by com.sptci.echo2.Updater
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
ModelUpdater, ViewUpdater

public abstract class Updater
extends java.lang.Object
implements java.io.Serializable

An abstract updater used to update UI containers or JavaBean objects from one another.

Copyright 2006 Sans Pareil Technologies, Inc.

Version:
$Id: Updater.java,v 1.3 2006/02/09 21:27:31 rakesh Exp $
Author:
Rakesh Vidyadharan 2006-02-07
See Also:
Serialized Form

Field Summary
protected  java.lang.Object bean
          The java bean that contains the data to use to update the uiContainer.
private static java.util.logging.Logger logger
          The logger used to log errors/warnings to.
protected  java.lang.Object uiContainer
          The UI container that is to be updated.
 
Constructor Summary
protected Updater()
          Default constructor.
protected Updater(java.lang.Object uiContainer, java.lang.Object bean)
          Create a new instance with the specified UI container and java bean.
 
Method Summary
protected  java.util.Map<java.lang.String,java.lang.Object> beanValues()
          Fetch the values of all the fields in bean that have an accessor method conforming to JavaBean naming convention.
 java.lang.Object getBean()
          Returns bean.
 java.lang.Object getUiContainer()
          Returns uiContainer.
 void setBean(java.lang.Object bean)
          Set bean.
 void setUiContainer(java.lang.Object uiContainer)
          Set uiContainer.
protected  java.util.Map<java.lang.String,java.lang.Object> uiValues()
          Fetch the values of all the fields in uiContainer.
abstract  void update()
          Update the fields of the desired component with the data contained in similarly named fields in the other component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static final transient java.util.logging.Logger logger
The logger used to log errors/warnings to.


uiContainer

protected java.lang.Object uiContainer
The UI container that is to be updated.


bean

protected java.lang.Object bean
The java bean that contains the data to use to update the uiContainer.

Constructor Detail

Updater

protected Updater()
Default constructor. Cannot be instantiated.


Updater

protected Updater(java.lang.Object uiContainer,
                  java.lang.Object bean)
Create a new instance with the specified UI container and java bean.

Parameters:
uiContainer - The uiContainer to use.
bean - The bean to use.
Method Detail

beanValues

protected java.util.Map<java.lang.String,java.lang.Object> beanValues()
                                                               throws java.lang.IllegalAccessException,
                                                                      java.lang.reflect.InvocationTargetException
Fetch the values of all the fields in bean that have an accessor method conforming to JavaBean naming convention.

Returns:
Map A map with the field name as key and the field value as value.
Throws:
java.lang.IllegalAccessException - If a custom security policy restricts access to the bean fields.
java.lang.reflect.InvocationTargetException - If the accessor method for the field could not be invoked successfully.
See Also:
ReflectionUtility.fetchFields(java.lang.Object), ReflectionUtility.fetchMethod( Object, String, Class[] )

uiValues

protected java.util.Map<java.lang.String,java.lang.Object> uiValues()
                                                             throws java.lang.IllegalAccessException,
                                                                    java.lang.reflect.InvocationTargetException
Fetch the values of all the fields in uiContainer. Convert the values of the UI components to the mapping scheme used in bean generation.

Returns:
Map A map with the field name as key and the field value as value.
Throws:
java.lang.IllegalAccessException - If a custom security policy restricts access to the bean fields.
java.lang.reflect.InvocationTargetException - If the accessor method for the field could not be invoked successfully.
See Also:
ReflectionUtility.fetchFields(java.lang.Object), ReflectionUtility.fetchMethod( Object, String, Class[] )

update

public abstract void update()
Update the fields of the desired component with the data contained in similarly named fields in the other component.


getUiContainer

public final java.lang.Object getUiContainer()
Returns uiContainer.

Returns:
Object The value/reference of/to uiContainer.

setUiContainer

public final void setUiContainer(java.lang.Object uiContainer)
Set uiContainer.

Parameters:
uiContainer - The value to set.

getBean

public final java.lang.Object getBean()
Returns bean.

Returns:
Object The value/reference of/to bean.

setBean

public final void setBean(java.lang.Object bean)
Set bean.

Parameters:
bean - The value to set.


Copyright © 2006 Sans Pareil Technologies, Inc. All Rights Reserved.