ca.grimoire.formtree
Class FormDecoder

java.lang.Object
  extended by ca.grimoire.formtree.FormDecoder

public class FormDecoder
extends java.lang.Object

Decodes tree-shaped form data into a receiver. Form keys are parsed and used to locate specific nodes in the receiver to use with the field's value.

Grammar:

 path ::= [pathElement '.'] pathElement
 pathElement ::= keyPathElement | listPathElement
 keyPathElement ::= NAME
 listPathElement ::= NAME '[' DIGITS ']'
 
 DIGITS ::= ('0'..'9')*
 NAMEINITIAL ::= ('-'|'_'|'a'..'z'|'A'..Z')
 NAMETRAILING ::= (NAMEINITIAL|DIGITS)
 NAME ::= NAMEINITIAL NAMETRAILING*
 

Example field names:


Constructor Summary
FormDecoder()
           
 
Method Summary
<T> T
decode(FormAdapter form, FormReceiver<T> receiver)
          Decodes a form, populating the receiver with values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FormDecoder

public FormDecoder()
Method Detail

decode

public <T> T decode(FormAdapter form,
                    FormReceiver<T> receiver)
Decodes a form, populating the receiver with values.

Type Parameters:
T - the expected form decoding result type.
Parameters:
form - an adapter over the form to decode.
receiver - an adapter to receive the decoded values.
Returns:
the form encoding result, from the receiver.


Copyright © 2011 Grimoire Alchymia. All Rights Reserved.