org.barracudamvc.core.forms
Class PrefixFormMapper

java.lang.Object
  extended byorg.barracudamvc.core.forms.DefaultFormMapper
      extended byorg.barracudamvc.core.forms.PrefixFormMapper
All Implemented Interfaces:
FormMapper

public class PrefixFormMapper
extends DefaultFormMapper

A PrefixFormMapFilter allows you to specify a prefix (ie. "addr1_") and only those keys which start with that prefix will actually get mapped. When they are mapped, they will be mapped without the prefix.

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

Field Summary
protected  String prefix
           
 
Fields inherited from class org.barracudamvc.core.forms.DefaultFormMapper
iterateOverParams, localLogger, mappedElements
 
Constructor Summary
PrefixFormMapper(String iprefix)
           
 
Method Summary
protected  FormElement getElementForMapping(FormMap fm, String paramKey)
          This method is used by the mapping process to look up FormElements.
 String getPrefix()
           
 FormElement mapElement(FormMap fm, String key, Object origVal)
          Map an individual element
 void setPrefix(String iprefix)
           
 
Methods inherited from class org.barracudamvc.core.forms.DefaultFormMapper
_mapElement, getElements, isNull, mapForm, postMap, preMap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

prefix

protected String prefix
Constructor Detail

PrefixFormMapper

public PrefixFormMapper(String iprefix)
Method Detail

mapElement

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

Specified by:
mapElement in interface FormMapper
Overrides:
mapElement in class DefaultFormMapper

setPrefix

public void setPrefix(String iprefix)

getPrefix

public String getPrefix()

getElementForMapping

protected FormElement getElementForMapping(FormMap fm,
                                           String paramKey)
Description copied from class: DefaultFormMapper
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.

Overrides:
getElementForMapping in class DefaultFormMapper


Copyright © 2004 BarracudaMVC.org All Rights Reserved.