C - the type of the data used to configureM - the type of data being returned by the loaderpublic class Loader<C,M> extends Object implements LoaderHandler.HasLoaderHandlers<C,M>
DataProxy and DataReader to help
perform the load operations. The DataProxy is responsible for
obtaining the remote data. The DataReader is responsible for
"processing" the remote data and converting the data to the expected format.
| Constructor and Description |
|---|
Loader(DataProxy<C,M> proxy)
Creates a new base loader instance.
|
Loader(DataProxy<C,T> proxy,
DataReader<M,T> reader)
Creates a new loader with the given proxy and reader.
|
| Modifier and Type | Method and Description |
|---|---|
HandlerRegistration |
addBeforeLoadHandler(BeforeLoadEvent.BeforeLoadHandler<C> handler)
Adds a
BeforeLoadEvent handler. |
HandlerRegistration |
addLoaderHandler(LoaderHandler<C,M> handler)
Adds a
LoadEvent handler. |
HandlerRegistration |
addLoadExceptionHandler(LoadExceptionEvent.LoadExceptionHandler<C> handler)
Adds a
LoadExceptionEvent handler. |
HandlerRegistration |
addLoadHandler(LoadHandler<C,M> handler)
Adds a
LoadEvent handler. |
C |
getLastLoadConfig()
Returns the last load config.
|
DataProxy<?,?> |
getProxy()
Returns the loader's data proxy.
|
boolean |
isReuseLoadConfig()
Returns true if the load config is being reused.
|
boolean |
load()
Loads the data using the current configuration.
|
boolean |
load(C loadConfig)
Loads the data using the given load configuration.
|
void |
setReuseLoadConfig(boolean reuseLoadConfig)
Sets whether the same load config instance should be used for load
operations (defaults to false).
|
public Loader(DataProxy<C,M> proxy)
proxy - the data proxypublic Loader(DataProxy<C,T> proxy, DataReader<M,T> reader)
proxy - the data proxyreader - the data readerpublic HandlerRegistration addBeforeLoadHandler(BeforeLoadEvent.BeforeLoadHandler<C> handler)
BeforeLoadEvent.HasBeforeLoadHandlersBeforeLoadEvent handler.addBeforeLoadHandler in interface BeforeLoadEvent.HasBeforeLoadHandlers<C>handler - the handlerpublic HandlerRegistration addLoaderHandler(LoaderHandler<C,M> handler)
LoaderHandler.HasLoaderHandlersLoadEvent handler.addLoaderHandler in interface LoaderHandler.HasLoaderHandlers<C,M>handler - the handlerpublic HandlerRegistration addLoadExceptionHandler(LoadExceptionEvent.LoadExceptionHandler<C> handler)
LoadExceptionEvent.HasLoadExceptionHandlersLoadExceptionEvent handler.addLoadExceptionHandler in interface LoadExceptionEvent.HasLoadExceptionHandlers<C>handler - the handlerpublic HandlerRegistration addLoadHandler(LoadHandler<C,M> handler)
LoadHandler.HasLoadHandlersLoadEvent handler.addLoadHandler in interface LoadHandler.HasLoadHandlers<C,M>handler - the handlerpublic C getLastLoadConfig()
public DataProxy<?,?> getProxy()
public boolean isReuseLoadConfig()
public boolean load()
BeforeLoadEvent before the request, then the LoadEvent
after the load operation.public boolean load(C loadConfig)
BeforeLoadEvent before the request, then the LoadEvent
after the load operation. The current load configuration object can be
retrieved using getLastLoadConfig().loadConfig - the load configpublic void setReuseLoadConfig(boolean reuseLoadConfig)
reuseLoadConfig - true to reuseCopyright © 2012. All Rights Reserved.