This
TableDataProvider wraps access to an
array of Java Objects. The
FieldKey s correspond to the JavaBean
properties and optionally the public member fields of the Java Objects.
Note that this
TableDataProvider determines which fields are
available by examining the underlying component data type of the array.
If you pass in an array that is of type Object[] , then, perhaps
with initialization code like this:
Map map = ...;
return new ObjectArrayDataProvider(map.values().toArray());
the fields of your actual object type will not be available. If you
know that your data is all of type Foo, do this instead:
Map map = ...;
return new ObjectArrayDataProvider
((Foo[]) map.values().toArray(new Foo[0]));
Since this
TableDataProvider wraps an array, and arrays in Java
are not intrinsically resizeable, this implementation will return
false for any call to canAppendRow() ,
canInsertRow() , or canRemoveRow() . It will
throw UnsupportedOperationException if you attempt to call
appendRow() , insertRow() , or
removeRow() .
WARNING - Until you call setArray() or
setObjectType() with a non-null parameter, or use a constructor
variant that accepts an non-null array, no information about field keys will
be available. Therefore, any attempt to reference a FieldKey
or field identifier in a method call will throw
IllegalArgumentException .
NOTE about Serializable: This class wraps access to an array of any Java
Objects. For this class to remain Serializable, the contained Objects must
also be Serializable.
author: Joe Nuxoll author: Winston Prakash (bug fixes) |