com.avaje.ebean.text.json
Interface JsonContext


public interface JsonContext

Converts objects to and from JSON format.

Author:
rbygrave

Method Summary
 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> rootType, Reader json)
          Convert json reader input into a Bean of a specific type.
<T> T
toBean(Class<T> rootType, Reader json, JsonReadOptions options)
          Convert json reader input into a Bean of a specific type with options.
<T> T
toBean(Class<T> rootType, String json)
          Convert json string input into a Bean of a specific type.
<T> T
toBean(Class<T> rootType, 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> rootType, Reader json)
          Convert json reader input into a list of beans of a specific type.
<T> List<T>
toList(Class<T> rootType, Reader json, JsonReadOptions options)
          Convert json reader input into a list of beans of a specific type with options.
<T> List<T>
toList(Class<T> rootType, String json)
          Convert json string input into a list of beans of a specific type.
<T> List<T>
toList(Class<T> rootType, 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.
 

Method Detail

toBean

<T> T toBean(Class<T> rootType,
             String json)
Convert json string input into a Bean of a specific type.


toBean

<T> T toBean(Class<T> rootType,
             Reader json)
Convert json reader input into a Bean of a specific type.


toBean

<T> T toBean(Class<T> rootType,
             String json,
             JsonReadOptions options)
Convert json string input into a Bean of a specific type with options.


toBean

<T> T toBean(Class<T> rootType,
             Reader json,
             JsonReadOptions options)
Convert json reader input into a Bean of a specific type with options.


toList

<T> List<T> toList(Class<T> rootType,
                   String json)
Convert json string input into a list of beans of a specific type.


toList

<T> List<T> toList(Class<T> rootType,
                   String json,
                   JsonReadOptions options)
Convert json string input into a list of beans of a specific type with options.


toList

<T> List<T> toList(Class<T> rootType,
                   Reader json)
Convert json reader input into a list of beans of a specific type.


toList

<T> List<T> toList(Class<T> rootType,
                   Reader json,
                   JsonReadOptions options)
Convert json reader input into a list of beans of a specific type with options.


toObject

Object toObject(Type genericType,
                Reader json,
                JsonReadOptions options)
Use the genericType to determine if this should be converted into a List or bean.


toObject

Object toObject(Type genericType,
                String json,
                JsonReadOptions options)
Use the genericType to determine if this should be converted into a List or bean.


toJsonWriter

void toJsonWriter(Object o,
                  Writer writer)
Write the bean or collection in JSON format to the writer with default options.

Parameters:
o - the bean or collection of beans to write
writer - used to write the json output to

toJsonWriter

void toJsonWriter(Object o,
                  Writer writer,
                  boolean pretty)
With additional pretty output option.


toJsonWriter

void toJsonWriter(Object o,
                  Writer writer,
                  boolean pretty,
                  JsonWriteOptions options)
With additional options to specify JsonValueAdapter and JsonWriteBeanVisitor's.

Parameters:
o - the bean or collection of beans to write
writer - used to write the json output to
options - additional options to control the JSON output

toJsonWriter

void toJsonWriter(Object o,
                  Writer writer,
                  boolean pretty,
                  JsonWriteOptions options,
                  String callback)
With additional JSONP callback function.


toJsonString

String toJsonString(Object o)
Convert a bean or collection to json string using default options.


toJsonString

String toJsonString(Object o,
                    boolean pretty)
Convert a bean or collection to json string with pretty format using default options.


toJsonString

String toJsonString(Object o,
                    boolean pretty,
                    JsonWriteOptions options)
Convert a bean or collection to json string using options.


toJsonString

String toJsonString(Object o,
                    boolean pretty,
                    JsonWriteOptions options,
                    String callback)
Convert a bean or collection to json string using a JSONP callback.


isSupportedType

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.



Copyright © 2010. All Rights Reserved.