com.docmosis.template.population
Class JSONDataProvider
java.lang.Object
com.docmosis.template.population.MemoryDataProvider
com.docmosis.template.population.JSONDataProvider
- All Implemented Interfaces:
- Cleanable, DataProvider, MutableDataProvider, Serializable
- public class JSONDataProvider
- extends MemoryDataProvider
A MemoryDataProvider that can load itself from JSON formatted data.
- See Also:
- Serialized Form
Methods inherited from class com.docmosis.template.population.MemoryDataProvider |
addDataProvider, cleanup, finalize, getBoolean, getBooleanKeys, getDataProvider, getDataProviderCount, getDataProviderKeys, getImage, getImageKeys, getRealKey, getString, getStringKeys, hasBooleanKey, hasDataProviderKey, hasImageKey, hasStringKey, setBoolean, setFalse, setImage, setImage, setString, setTrue, toDebugString, toDebugString, toString |
JSONDataProvider
public JSONDataProvider()
JSONDataProvider
public JSONDataProvider(String jsonString,
StringInterceptor[] interceptors)
throws JSONException
- Construct a data provider from a JSON string.
- Parameters:
jsonString
- the JSON string.interceptors
- an array of interceptors that have the opportunity to
interpret the given key and value and add the data to this data provider
in a different form.
toJSONString
public String toJSONString()
throws JSONException
- Convert this Data Provider into a JSON string.
- Returns:
- a string containing the JSON content - can be written to a file.
- Throws:
JSONException
- for serious unexpected errors.
ClassCastException
- if any sub data provider of dp is not a MemoryDataProvider
(or subclass).
toJSONString
public static String toJSONString(MemoryDataProvider dp)
throws JSONException
- Convert the given Data Provider into a JSON string.
- Parameters:
dp
- the data provider to convert (must be a MemoryDataProvider or subclass).
- Returns:
- a string containing the JSON content - can be written to a file.
- Throws:
JSONException
- for serious unexpected errors.
ClassCastException
- if any sub data provider of dp is not a MemoryDataProvider
(or subclass).
Copyright © 2014 Docmosis Pty Ltd. All Rights Reserved.