|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectca.grimoire.formtree.receiver.constructor.ConstructorReceiver<T>
T - the type to return from form parsing.public class ConstructorReceiver<T>
A FormReceiver which populates arbitrary object graphs, rooted at an
instance of a specific class. This strategy uses constructor invocation to
create each node in the object graph.
| Constructor Summary | |
|---|---|
ConstructorReceiver(java.lang.Class<T> formClass)
Prepares to construct an instance of formClass using form data. |
|
| Method Summary | ||
|---|---|---|
static boolean |
accepts(java.lang.Class<?> formClass)
Checkes whether ConstructorReceiver is able to construct forms of
a given class. |
|
static
|
create(java.lang.Class<T> elementClass)
A type-inferring alternative to ConstructorReceiver(Class). |
|
T |
finished()
Condense the collected form data from this receiver and all receivers created from it into an instance of <T>. |
|
FormElementReceiver |
index(int index)
Ignores index access entirely. |
|
FormElementReceiver |
key(java.lang.String field)
Returns a FormElementReceiver appropriate for the named field. |
|
void |
values(java.lang.Iterable<java.lang.String> values)
Ignores attempts to assign immediate values to a constructor. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ConstructorReceiver(java.lang.Class<T> formClass)
FormField).
If the class has multiple form constructors, the constructor used is unspecified.
Any fields in the form that cannot be mapped to the chosen form constructor will be ignored.
formClass - the class to construct.
java.lang.IllegalArgumentException - if the class has no form constructors.| Method Detail |
|---|
public static boolean accepts(java.lang.Class<?> formClass)
ConstructorReceiver is able to construct forms of
a given class. ConstructorReceiver can construct any class that
has at least one form constructor (any constructor where all parameters
are annotated with FormField).
formClass - the class to interrogate.
ConstructorReceiver can populate
formClass.public static <T> ConstructorReceiver<T> create(java.lang.Class<T> elementClass)
ConstructorReceiver(Class).
T - the type of the created form element.elementClass - the class of <T>
ConstructorReceiver.public T finished()
finished in interface FormReceiver<T>FormReceiver.finished()public FormElementReceiver key(java.lang.String field)
FormElementReceiver appropriate for the named field.
Fields that don't map to constructor parameters will be silently ignored.
key in interface FormElementReceiverfield - the field to decode.
FormElementReceiver.key(java.lang.String)public FormElementReceiver index(int index)
index in interface FormElementReceiverindex - the index to decode.
FormElementReceiver.index(int)public void values(java.lang.Iterable<java.lang.String> values)
values in interface FormElementReceivervalues - the values to store.FormElementReceiver.values(java.lang.Iterable)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||