|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.barracudamvc.core.forms.DefaultFormMapper
org.barracudamvc.core.forms.UIDFormMapper
public class UIDFormMapper
A UIDFormMapFilter makes it possible to map similar form elements based on a UID. For instance, let's say you have a url which contains parameters something like this:
What we really have here is a list of data "rows" that have been flattened using a simple naming convention (key + "::" + uid = value). In other words, the data viewed hierarchically would really look something like this:
The naming convention has been used to flatten a hierarchical set of data into a flat set of data which can be submitted via a URL.
If we were dealing with a finite, known set of uids, then we could define every item as its own form element, but that would be very burdensome on the developer, plus there will be many cases where we don't know the uids. What we need then is a form map that is smart enough to handle such a UID naming scheme, and take it into account automatically. That's what this class does.
When mapping the form, this filter causes any element which conform to a basic pattern (key + uid token + uid) to be mapped using the previously defined element for key.
Field Summary | |
---|---|
static String |
UID_TOKEN
|
protected Set |
uids
|
protected String |
uidToken
|
Fields inherited from class org.barracudamvc.core.forms.DefaultFormMapper |
---|
iterateOverParams, localLogger, mappedElements |
Constructor Summary | |
---|---|
UIDFormMapper()
Create a default UID form amp filter. |
|
UIDFormMapper(String iuidToken)
Create a UID form map using a custom UID token |
Method Summary | |
---|---|
FormElement |
getElementByUID(FormMap fm,
String subKey,
String uid)
|
protected FormElement |
getElementForMapping(FormMap fm,
String paramKey)
This method is used by the mapping process to look up FormElements. |
Set |
getMappedUIDs()
|
protected void |
preMap()
Invoked before mapping begins |
Methods inherited from class org.barracudamvc.core.forms.DefaultFormMapper |
---|
_mapElement, getElements, isNull, mapElement, mapForm, postMap |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String UID_TOKEN
protected Set uids
protected String uidToken
Constructor Detail |
---|
public UIDFormMapper()
public UIDFormMapper(String iuidToken)
Method Detail |
---|
protected void preMap()
DefaultFormMapper
preMap
in class DefaultFormMapper
protected FormElement getElementForMapping(FormMap fm, String paramKey)
DefaultFormMapper
getElementForMapping
in class DefaultFormMapper
public Set getMappedUIDs()
public FormElement getElementByUID(FormMap fm, String subKey, String uid)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |