com.extjs.gxt.ui.client.data
Class BeanModelReader

java.lang.Object
  extended by com.extjs.gxt.ui.client.data.BeanModelReader
All Implemented Interfaces:
DataReader<ListLoadResult<ModelData>>

public class BeanModelReader
extends java.lang.Object
implements DataReader<ListLoadResult<ModelData>>

A DataReader for beans using a BeanModelFactory. Valid return types are a list of beans or a list load result containing a list of beans. Beans must be of the same type and beans must implement BeanModelTag or have a companion BeanModelMarker marker class.


Constructor Summary
BeanModelReader()
           
 
Method Summary
 boolean isFactoryForEachBean()
          Return if a BeanModelFactory is created for each bean or not.
protected  ListLoadResult<ModelData> newLoadResult(java.lang.Object loadConfig, java.util.List<ModelData> models)
          Template method that provides a new load result.
 ListLoadResult<ModelData> read(java.lang.Object loadConfig, java.lang.Object data)
          Reads the raw data and returns the typed data.
 void setFactoryForEachBean(boolean factoryForEachBean)
          Set to true to create a BeanModelFactory for each bean in the list (defaults to false).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanModelReader

public BeanModelReader()
Method Detail

isFactoryForEachBean

public boolean isFactoryForEachBean()
Return if a BeanModelFactory is created for each bean or not.

Returns:
true if a BeanModelFactory is created for each bean or not

read

public ListLoadResult<ModelData> read(java.lang.Object loadConfig,
                                      java.lang.Object data)
Description copied from interface: DataReader
Reads the raw data and returns the typed data.

Specified by:
read in interface DataReader<ListLoadResult<ModelData>>
data - the data to read
Returns:
the data

setFactoryForEachBean

public void setFactoryForEachBean(boolean factoryForEachBean)
Set to true to create a BeanModelFactory for each bean in the list (defaults to false).

Parameters:
factoryForEachBean - true to enable

newLoadResult

protected ListLoadResult<ModelData> newLoadResult(java.lang.Object loadConfig,
                                                  java.util.List<ModelData> models)
Template method that provides a new load result.

Parameters:
models - the models
Returns:
the load result