T
- The modelpublic abstract class BaseJsonSerializer<T> extends BaseJsonExtensions
Constructor and Description |
---|
BaseJsonSerializer() |
Modifier and Type | Method and Description |
---|---|
org.json.JSONArray |
buildJson(java.util.List<T> objectList) |
org.json.JSONObject |
buildJson(T object) |
abstract org.json.JSONObject |
buildJson(T object,
boolean includeRoot) |
protected org.json.JSONObject |
wrapRoot(org.json.JSONObject jsonObject,
java.lang.String rootKey,
boolean includeRoot)
Wrap (or not) a JSONObject into a root element.
|
dateFormatter, datetimeFormatter, optCollection, optDate, optDateTime, optIntegerCollection, optIntegerList, optIntegerSet, optString, optStringCollection, optStringList, optStringSet
public abstract org.json.JSONObject buildJson(T object, boolean includeRoot)
object
- A T instanceincludeRoot
- Whether to wrap in root element or notpublic org.json.JSONObject buildJson(T object)
object
- A T instancepublic org.json.JSONArray buildJson(java.util.List<T> objectList)
objectList
- A list of T instancesprotected org.json.JSONObject wrapRoot(org.json.JSONObject jsonObject, java.lang.String rootKey, boolean includeRoot)
jsonObject
- A JSONObjectrootKey
- The root element keyincludeRoot
- Whether to wrap in root element or not