public class DJsonContext extends Object implements JsonContext
| Constructor and Description |
|---|
DJsonContext(SpiEbeanServer server,
JsonValueAdapter dfltValueAdapter,
boolean dfltPretty) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
isSupportedType(Type genericType)
Return true if the type is known as an Entity or Xml type or a List Set or
Map of known bean types.
|
<T> T |
toBean(Class<T> cls,
Reader jsonReader)
Convert json reader input into a Bean of a specific type.
|
<T> T |
toBean(Class<T> cls,
Reader jsonReader,
JsonReadOptions options)
Convert json reader input into a Bean of a specific type with options.
|
<T> T |
toBean(Class<T> cls,
String json)
Convert json string input into a Bean of a specific type.
|
<T> T |
toBean(Class<T> cls,
String json,
JsonReadOptions options)
Convert json string input into a Bean of a specific type with options.
|
String |
toJsonString(Object o)
Convert a bean or collection to json string using default options.
|
String |
toJsonString(Object o,
boolean pretty)
Convert a bean or collection to json string with pretty format using
default options.
|
String |
toJsonString(Object o,
boolean pretty,
JsonWriteOptions options)
Convert a bean or collection to json string using options.
|
String |
toJsonString(Object o,
boolean pretty,
JsonWriteOptions options,
String callback)
Convert a bean or collection to json string using a JSONP callback.
|
void |
toJsonWriter(Object o,
Writer writer)
Write the bean or collection in JSON format to the writer with default
options.
|
void |
toJsonWriter(Object o,
Writer writer,
boolean pretty)
With additional pretty output option.
|
void |
toJsonWriter(Object o,
Writer writer,
boolean pretty,
JsonWriteOptions options)
With additional options to specify JsonValueAdapter and
JsonWriteBeanVisitor's.
|
void |
toJsonWriter(Object o,
Writer writer,
boolean pretty,
JsonWriteOptions options,
String callback)
With additional JSONP callback function.
|
<T> List<T> |
toList(Class<T> cls,
Reader jsonReader)
Convert json reader input into a list of beans of a specific type.
|
<T> List<T> |
toList(Class<T> cls,
Reader jsonReader,
JsonReadOptions options)
Convert json reader input into a list of beans of a specific type with
options.
|
<T> List<T> |
toList(Class<T> cls,
String json)
Convert json string input into a list of beans of a specific type.
|
<T> List<T> |
toList(Class<T> cls,
String json,
JsonReadOptions options)
Convert json string input into a list of beans of a specific type with
options.
|
Object |
toObject(Type genericType,
Reader json,
JsonReadOptions options)
Use the genericType to determine if this should be converted into a List or
bean.
|
Object |
toObject(Type genericType,
String json,
JsonReadOptions options)
Use the genericType to determine if this should be converted into a List or
bean.
|
public DJsonContext(SpiEbeanServer server, JsonValueAdapter dfltValueAdapter, boolean dfltPretty)
public boolean isSupportedType(Type genericType)
JsonContextisSupportedType in interface JsonContextpublic <T> T toBean(Class<T> cls, String json)
JsonContexttoBean in interface JsonContextpublic <T> T toBean(Class<T> cls, Reader jsonReader)
JsonContexttoBean in interface JsonContextpublic <T> T toBean(Class<T> cls, String json, JsonReadOptions options)
JsonContexttoBean in interface JsonContextpublic <T> T toBean(Class<T> cls, Reader jsonReader, JsonReadOptions options)
JsonContexttoBean in interface JsonContextpublic <T> List<T> toList(Class<T> cls, String json)
JsonContexttoList in interface JsonContextpublic <T> List<T> toList(Class<T> cls, String json, JsonReadOptions options)
JsonContexttoList in interface JsonContextpublic <T> List<T> toList(Class<T> cls, Reader jsonReader)
JsonContexttoList in interface JsonContextpublic <T> List<T> toList(Class<T> cls, Reader jsonReader, JsonReadOptions options)
JsonContexttoList in interface JsonContextpublic Object toObject(Type genericType, String json, JsonReadOptions options)
JsonContexttoObject in interface JsonContextpublic Object toObject(Type genericType, Reader json, JsonReadOptions options)
JsonContexttoObject in interface JsonContextpublic void toJsonWriter(Object o, Writer writer)
JsonContexttoJsonWriter in interface JsonContexto - the bean or collection of beans to writewriter - used to write the json output topublic void toJsonWriter(Object o, Writer writer, boolean pretty)
JsonContexttoJsonWriter in interface JsonContextpublic void toJsonWriter(Object o, Writer writer, boolean pretty, JsonWriteOptions options)
JsonContexttoJsonWriter in interface JsonContexto - the bean or collection of beans to writewriter - used to write the json output tooptions - additional options to control the JSON outputpublic void toJsonWriter(Object o, Writer writer, boolean pretty, JsonWriteOptions options, String callback)
JsonContexttoJsonWriter in interface JsonContextpublic String toJsonString(Object o)
JsonContexttoJsonString in interface JsonContextpublic String toJsonString(Object o, boolean pretty)
JsonContexttoJsonString in interface JsonContextpublic String toJsonString(Object o, boolean pretty, JsonWriteOptions options)
JsonContexttoJsonString in interface JsonContextpublic String toJsonString(Object o, boolean pretty, JsonWriteOptions options, String callback)
JsonContexttoJsonString in interface JsonContextCopyright © 2014. All Rights Reserved.