ModelUtils
Functions
Link copied to clipboard
Parse a JSONObject to a class that extends ModelObject using its ModelObject.Serializer.
Link copied to clipboard
fun <T : ModelObject> deserializeOpt(jsonObject: JSONObject?, serializer: ModelObject.Serializer<T>): T?
Parse a JSONObject to a class that extends ModelObject using its ModelObject.Serializer. Result can also be null if the object is null.
Link copied to clipboard
fun <T : ModelObject> deserializeOptList(jsonArray: JSONArray?, serializer: ModelObject.Serializer<T>): List<T>?
Parse a JSONArray to a List of objects that extend ModelObject. Result can also be null if the object is null.
Link copied to clipboard
fun <T : ModelObject> serializeOpt(modelObject: T?, serializer: ModelObject.Serializer<T>): JSONObject?
Serializes a class extending ModelObject into a JSONObject.
Link copied to clipboard
fun <T : ModelObject> serializeOptList(modelList: List<T>?, serializer: ModelObject.Serializer<T>): JSONArray?
Serializes a List containing objects that extend ModelObject into a JSONArray.