T - The typepublic abstract class AbstractJsonWriter<T> extends AbstractWriter<T> implements JsonWriter<T>
| Modifier and Type | Field and Description |
|---|---|
protected JsonRegistry |
jsonRegistry |
handlerManager, idMap, logger| Modifier | Constructor and Description |
|---|---|
protected |
AbstractJsonWriter() |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
isBoolean(String booleanValue) |
protected boolean |
isNumber(String numberValue) |
String |
toJson(List<T> models,
String arrayKey)
Generates JSON data for the list of Ts according to the annotated
properties in T.
|
addModelWriteHandler, fireEventclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waittoJsonaddModelWriteHandlerprotected final JsonRegistry jsonRegistry
public String toJson(List<T> models, String arrayKey)
JsonWriter
List<RunnableMessageContext> rmcs = ...;
String json = RunnableMessageContext.JSON_WRITER.toJson(rmcs, "data");
// json will be somethig like {"data":[...]}
toJson in interface JsonWriter<T>models - the list of Ts to serialize to JSON. May be null.arrayKey - the array keynull if
models and/or arrayKey is null.protected boolean isBoolean(String booleanValue)
protected boolean isNumber(String numberValue)
Copyright © 2012 Harald Pehl. All Rights Reserved.