|
Docmosis API 4.9.0 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.docmosis.template.population.CompoundDataProvider
public class CompoundDataProvider
A DataProvider that provides a "chain" of data providers. The DataProviders
are used in the order they are added, so the first data provider will be used
to supply a value in preference to the Data Provider added second, and so on.
This allows arbitrary data providers to be linked together in a priority order.
To determine if a data provider can provide a value, the has*Key() methods
are used. If has*Key() returns true for a DataProvider, then that DataProvider
will be used. This allows a data provider to override values in another data
provider, even with null/zero values.
Also, some methods allow arbitrary Objects to be added. Objects added via these
methods will automatically be wrapped in a ReflectiveDataProvider if the Object
does not already implement DataProvider.
| Constructor Summary | |
|---|---|
CompoundDataProvider()
|
|
| Method Summary | |
|---|---|
CompoundDataProvider |
addDataObject(Object dp)
Add an arbitrary object as a data provider to this compound provider. |
CompoundDataProvider |
addDataObject(Object dp,
boolean forgiving)
Add an arbitrary object as a data provider to this compound provider. |
CompoundDataProvider |
addDataProvider(DataProvider dp)
Add a data provider to this compound provider. |
CompoundDataProvider |
addDataProviders(DataProvider[] dps)
Add an array of DataProviders to this compound provider. |
CompoundDataProvider |
addDataProviders(List dps)
Add a List of arbitrary objects as data providers to this compound provider. |
boolean |
getBoolean(String key)
Return the value from the first data provider that has a boolean for the given key. |
DataProvider |
getDataProvider(String key,
int index)
Return the value from the first data provider that has a DataProvider for the given key. |
int |
getDataProviderCount(String key)
Return the value from the first data provider that has a DataProvider for the given key. |
InputStream |
getImage(String key)
Return the value from the first data provider that has an image for the given key. |
DataProvider |
getLastDataProvider()
Get the last DataProvider in the compounded set of data providers |
String |
getString(String key)
Return the value from the first data provider that has a String for the given key. |
boolean |
hasBooleanKey(String key)
Return true if any data provider has a boolean for the given key |
boolean |
hasDataProviderKey(String key)
Return true if any data provider has a DataProvider for the given key |
boolean |
hasImageKey(String key)
Return true if any data provider has an image for the given key |
boolean |
hasStringKey(String key)
Return true if any data provider has a String for the given key |
String |
toString()
|
String |
toStringPretty()
Attempt to return a pretty String representation of the DataProvider |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public CompoundDataProvider()
| Method Detail |
|---|
public CompoundDataProvider addDataProvider(DataProvider dp)
dp - the data provider to add
IllegalArgumentException - if the given DataProvider is nullpublic DataProvider getLastDataProvider()
public CompoundDataProvider addDataObject(Object dp)
dp - the object to add as a data provider
IllegalArgumentException - if the given Object is null
public CompoundDataProvider addDataObject(Object dp,
boolean forgiving)
dp - the object to add as a data providerforgiving - the mode to set for an created ReflectiveDataProvider
IllegalArgumentException - if the given Object is nullpublic CompoundDataProvider addDataProviders(DataProvider[] dps)
dps - the array to add as a data providers
IllegalArgumentException - if the given array is null or contains
a null itempublic CompoundDataProvider addDataProviders(List dps)
dps - the List of objects to add as data providers
IllegalArgumentException - if the given List is null or contains a null elementpublic boolean getBoolean(String key)
getBoolean in interface DataProviderkey - the key to lookup
DataProvider.getBoolean(String)
public DataProvider getDataProvider(String key,
int index)
getDataProvider in interface DataProviderkey - the key (name) of the data provider to look for.index - the index of the data provider.
DataProvider.getDataProvider(String, int)public int getDataProviderCount(String key)
getDataProviderCount in interface DataProviderkey - the key (name) of the data providers to look for.
DataProvider.getDataProviderCount(String)public InputStream getImage(String key)
getImage in interface DataProviderkey - the key under which to locate the image.
DataProvider.getImage(String)public String getString(String key)
getString in interface DataProviderkey - the to look up the value
DataProvider.getString(String)public boolean hasBooleanKey(String key)
hasBooleanKey in interface DataProviderkey - the key to lookup
DataProvider.hasBooleanKey(String)public boolean hasDataProviderKey(String key)
hasDataProviderKey in interface DataProviderkey - the key with which to lookup the data provider
DataProvider.hasDataProviderKey(String)public boolean hasImageKey(String key)
hasImageKey in interface DataProviderkey - the key for the String
DataProvider.hasImageKey(String)public boolean hasStringKey(String key)
hasStringKey in interface DataProviderkey - the key for the String
DataProvider.hasStringKey(String)public String toString()
toString in class Objectpublic String toStringPretty()
DataProvider
toStringPretty in interface DataProvider
|
Docmosis API 4.9.0 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||