org.barracudamvc.core.forms
Class DefaultFormMapper

java.lang.Object
  extended by org.barracudamvc.core.forms.DefaultFormMapper
All Implemented Interfaces:
FormMapper
Direct Known Subclasses:
PrefixFormMapper, UIDFormMapper

public class DefaultFormMapper
extends Object
implements FormMapper

A FormMapFilter is used to provide a control what elements get mapped in a form

Since:
2.0
Author:
Christian Cryder [christianc@granitepeaks.com]

Field Summary
protected  boolean iterateOverParams
           
protected static org.apache.log4j.Logger localLogger
           
protected  Map mappedElements
           
 
Constructor Summary
DefaultFormMapper()
           
 
Method Summary
protected  Object _mapElement(FormMap fm, FormElement element, Object origVal)
          Actually map a value to a form element.
protected  FormElement getElementForMapping(FormMap fm, String paramKey)
          This method is used by the mapping process to look up FormElements.
 Map getElements()
          Returns a map containing all elements mapped by this mapper (will return an empty map if the form has not been mapped yet)
protected  boolean isNull(Object val)
          This method defines what the FormMap identifies as null-value.
 FormElement mapElement(FormMap fm, String key, Object origVal)
          Map an individual element
 FormMap mapForm(FormMap fm, Map paramMap)
          Map a whole form
protected  void postMap()
          Invoked after mapping is completed
protected  void preMap()
          Invoked before mapping begins
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

localLogger

protected static final org.apache.log4j.Logger localLogger

mappedElements

protected Map mappedElements

iterateOverParams

protected boolean iterateOverParams
Constructor Detail

DefaultFormMapper

public DefaultFormMapper()
Method Detail

mapForm

public FormMap mapForm(FormMap fm,
                       Map paramMap)
Map a whole form

Specified by:
mapForm in interface FormMapper

mapElement

public FormElement mapElement(FormMap fm,
                              String key,
                              Object origVal)
Map an individual element

Specified by:
mapElement in interface FormMapper

_mapElement

protected Object _mapElement(FormMap fm,
                             FormElement element,
                             Object origVal)
Actually map a value to a form element. Returns the mapped value.


getElements

public Map getElements()
Returns a map containing all elements mapped by this mapper (will return an empty map if the form has not been mapped yet)

Specified by:
getElements in interface FormMapper

preMap

protected void preMap()
Invoked before mapping begins


getElementForMapping

protected FormElement getElementForMapping(FormMap fm,
                                           String paramKey)
This method is used by the mapping process to look up FormElements. It basically provides a way for the filter to determine whether or not mapping should occur. You can override this method of control what gets mapped and what doesn't. Based on the target key, the mapper either passes back the appropriate FormElement to map the key to, or it returns null to indicate the element should not be mapped.


postMap

protected void postMap()
Invoked after mapping is completed


isNull

protected boolean isNull(Object val)
This method defines what the FormMap identifies as null-value. If this doesn't suit your needs, you can simply overload it.

Parameters:
val - The value from request or statemap
Returns:
if the value is considered to be null


Copyright © 2006 BarracudaMVC.org All Rights Reserved.