com.ervacon.springframework.web.servlet.mvc.webflow
Class ParameterizableModelMapper

java.lang.Object
  extended bycom.ervacon.springframework.web.servlet.mvc.webflow.ParameterizableModelMapper
All Implemented Interfaces:
ModelMapper

public class ParameterizableModelMapper
extends java.lang.Object
implements ModelMapper

Simple model mapper that allows mappings to be configured in the Spring application context.

Exposed configuration properties:

name default description
toMappingsList empty Mappings executed when mapping model data to the sub flow. The given list contains model entry names. The same name is used in both parent flow and sub flow model.
toMappingsMap empty Mappings executed when mapping model data to the sub flow. The keys in given list are the names of entries in the parent model that will be mapped. The value associated with a key is the name of the target entry in the sub flow model.
fromMappingsList empty Mappings executed when mapping model data from the sub flow. The given list contains model entry names. The same name is used in both parent flow and sub flow model.
fromMappingsMap empty Mappings executed when mapping model data from the sub flow. The keys in given list are the names of entries in the sub flow model that will be mapped. The value associated with a key is the name of the target entry in the parent model.

The mappings defined using the above configuration properties fully support bean property access. So an entry name in a mapping can either be "beanName" or "beanName.propName". Nested property values are also supported ("beanName.propName.propName").

Author:
Erwin Vervaet

Constructor Summary
ParameterizableModelMapper()
           
 
Method Summary
protected  org.springframework.beans.BeanWrapper createBeanWrapper(java.lang.Object obj)
          Create a new bean wrapper wrapping given object.
protected  void map(java.util.Map from, java.util.Map to, java.util.Map mappings)
          Map data from one map to another map using specified mappings.
 void mapFromSubFlow(java.util.Map parentFlowModel, java.util.Map subFlowModel)
          Map model data from the sub flow back to the parent flow.
 void mapToSubFlow(java.util.Map parentFlowModel, java.util.Map subFlowModel)
          Map model data from the parent flow to the sub flow.
 void setFromMappingsList(java.util.List fromMappingsList)
          Set the mappings that will be executed when mapping model data from the sub flow.
 void setFromMappingsMap(java.util.Map fromMappings)
          Set the mappings that will be executed when mapping model data from the sub flow.
 void setToMappingsList(java.util.List toMappingsList)
          Set the mappings that will be executed when mapping model data to the sub flow.
 void setToMappingsMap(java.util.Map toMappings)
          Set the mappings that will be executed when mapping model data to the sub flow.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParameterizableModelMapper

public ParameterizableModelMapper()
Method Detail

setToMappingsList

public void setToMappingsList(java.util.List toMappingsList)

Set the mappings that will be executed when mapping model data to the sub flow. All keys in given list will be mapped.


setToMappingsMap

public void setToMappingsMap(java.util.Map toMappings)

Set the mappings that will be executed when mapping model data to the sub flow. The keys are the names in the parent flow model, the corresponding values are the names in the sub flow model.


setFromMappingsList

public void setFromMappingsList(java.util.List fromMappingsList)

Set the mappings that will be executed when mapping model data from the sub flow. All keys in given list will be mapped.


setFromMappingsMap

public void setFromMappingsMap(java.util.Map fromMappings)

Set the mappings that will be executed when mapping model data from the sub flow. The keys are the names in the sub flow model, the corresponding values are the names in the parent flow model.


mapToSubFlow

public void mapToSubFlow(java.util.Map parentFlowModel,
                         java.util.Map subFlowModel)
Description copied from interface: ModelMapper

Map model data from the parent flow to the sub flow. This is called before the sub flow is started.

Specified by:
mapToSubFlow in interface ModelMapper
Parameters:
parentFlowModel - parent flow model
subFlowModel - sub flow model

mapFromSubFlow

public void mapFromSubFlow(java.util.Map parentFlowModel,
                           java.util.Map subFlowModel)
Description copied from interface: ModelMapper

Map model data from the sub flow back to the parent flow. This is called after the sub flow completes and before the parent flow continues.

Specified by:
mapFromSubFlow in interface ModelMapper
Parameters:
parentFlowModel - parent flow model
subFlowModel - sub flow model

map

protected void map(java.util.Map from,
                   java.util.Map to,
                   java.util.Map mappings)

Map data from one map to another map using specified mappings.


createBeanWrapper

protected org.springframework.beans.BeanWrapper createBeanWrapper(java.lang.Object obj)

Create a new bean wrapper wrapping given object. Can be redefined in subclasses in case special property editors need to be registered or when other similar tuning is required.