ca.grimoire.formtree.receiver.constructor
Class ListReceiver<T>

java.lang.Object
  extended by ca.grimoire.formtree.receiver.constructor.CollectionReceiver<T,java.util.List<T>>
      extended by ca.grimoire.formtree.receiver.constructor.ListReceiver<T>
Type Parameters:
T - the class of the array elements.
All Implemented Interfaces:
FormElementReceiver, FormReceiver<java.util.List<T>>

public class ListReceiver<T>
extends CollectionReceiver<T,java.util.List<T>>

Receives form elements into an List of some constructible class. The array may be dense (if handled via the CollectionReceiver.values(Iterable) method) or sparse (if handled via the CollectionReceiver.key(String) method).

See Also:
ConstructorReceiver

Field Summary
 
Fields inherited from class ca.grimoire.formtree.receiver.constructor.CollectionReceiver
elementClass
 
Constructor Summary
ListReceiver(java.lang.Class<T> elementClass)
          Creates a receiver for a given element class.
 
Method Summary
static java.lang.Class<?> acceptableListType(java.lang.reflect.Type type)
          Determines if some Type represents a list of constructible elements.
static
<T> ListReceiver<T>
create(java.lang.Class<T> elementClass)
          A type-inferring alternative to ListReceiver(Class).
protected  java.util.List<T> createCollection(java.util.List<T> elements)
          Returns elements unchanged - it's already the right type.
 
Methods inherited from class ca.grimoire.formtree.receiver.constructor.CollectionReceiver
acceptableElementClass, acceptableElementClass, finished, index, key, values
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ListReceiver

public ListReceiver(java.lang.Class<T> elementClass)
Creates a receiver for a given element class.

Parameters:
elementClass - the Class of <T>
Method Detail

acceptableListType

public static java.lang.Class<?> acceptableListType(java.lang.reflect.Type type)
Determines if some Type represents a list of constructible elements.

Parameters:
type - the Type to examine.
Returns:
the Class of the elements of the list, or null if type is not the type of a list of constructible types.

create

public static <T> ListReceiver<T> create(java.lang.Class<T> elementClass)
A type-inferring alternative to ListReceiver(Class).

Type Parameters:
T - the class of the array elements.
Parameters:
elementClass - the Class of <T>
Returns:
a new ListReceiver.

createCollection

protected java.util.List<T> createCollection(java.util.List<T> elements)
Returns elements unchanged - it's already the right type.

Specified by:
createCollection in class CollectionReceiver<T,java.util.List<T>>
Parameters:
elements - the collection contents.
Returns:
the corresponding collection.
See Also:
CollectionReceiver.createCollection(java.util.List)


Copyright © 2011 Grimoire Alchymia. All Rights Reserved.