Class JsonGeneratorImpl
- java.lang.Object
-
- org.exoplatform.ws.frameworks.json.impl.JsonGeneratorImpl
-
- All Implemented Interfaces:
JsonGenerator
public class JsonGeneratorImpl extends Object implements JsonGenerator
- Version:
- $Id: JsonGeneratorImpl.java 34417 2009-07-23 14:42:56Z dkatayev $
- Author:
- Andrey Parfonov
-
-
Constructor Summary
Constructors Constructor Description JsonGeneratorImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JsonValuecreateJsonArray(Object array)Create JSON array from specified object.JsonValuecreateJsonArray(Collection<?> collection)Create JSON array from specified collection.JsonValuecreateJsonObject(Object object)Create JSON object from specified object.JsonValuecreateJsonObjectFromMap(Map<String,?> map)Create JSON object from specified map.JsonValuecreateJsonObjectFromString(String s)Create JSON object from specified string imply it is JSON object in String format.
-
-
-
Method Detail
-
createJsonArray
public JsonValue createJsonArray(Collection<?> collection) throws JsonException
Create JSON array from specified collection.- Parameters:
collection- source collection- Returns:
- JSON representation of collection
- Throws:
JsonException- if collection can't be transformed in JSON representation
-
createJsonArray
public JsonValue createJsonArray(Object array) throws JsonException
Create JSON array from specified object. Parameterarraymust be array.- Parameters:
array- source array- Returns:
- JSON representation of array
- Throws:
JsonException- if array can't be transformed in JSON representation
-
createJsonObjectFromMap
public JsonValue createJsonObjectFromMap(Map<String,?> map) throws JsonException
Create JSON object from specified map.- Parameters:
map- source map- Returns:
- JSON representation of map
- Throws:
JsonException- if map can't be transformed in JSON representation
-
createJsonObjectFromString
public JsonValue createJsonObjectFromString(String s) throws JsonException
Create JSON object from specified string imply it is JSON object in String format.- Parameters:
s- source string- Returns:
- JSON representation of map
- Throws:
JsonException- if map can't be transformed in JSON representation
-
createJsonObject
public JsonValue createJsonObject(Object object) throws JsonException
Create JSON object from specified object. Object must be conform with java bean structure.- Specified by:
createJsonObjectin interfaceJsonGenerator- Parameters:
object- source object- Returns:
- JSON representation of object
- Throws:
JsonException- if map can't be transformed in JSON representation
-
-