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 Details

    • JsonGeneratorImpl

      public JsonGeneratorImpl()
  • Method Details

    • 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. Parameter array must 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:
      createJsonObject in interface JsonGenerator
      Parameters:
      object - source object
      Returns:
      JSON representation of object
      Throws:
      JsonException - if map can't be transformed in JSON representation