net.sourceforge.javajson.converter
Class Utils

java.lang.Object
  extended by net.sourceforge.javajson.converter.Utils

public class Utils
extends Object


Field Summary
static DateFormat dateFormat
           
 
Constructor Summary
Utils()
           
 
Method Summary
static void fromJson(Object obj, JsonObject json)
           
static boolean objectIntoJsonArray(JsonArray arr, Object o)
          Adds known simple types to the json array
static boolean objectIntoJsonObject(JsonObject obj, String key, Object o)
          Adds known simple types to the json object
static JsonObject toJson(Object obj, Class cls)
          Convers an object to a simple (flat) json object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dateFormat

public static DateFormat dateFormat
Constructor Detail

Utils

public Utils()
Method Detail

fromJson

public static void fromJson(Object obj,
                            JsonObject json)
                     throws IllegalArgumentException,
                            IllegalAccessException,
                            InvocationTargetException,
                            InstantiationException,
                            ClassNotFoundException
Throws:
IllegalArgumentException
IllegalAccessException
InvocationTargetException
InstantiationException
ClassNotFoundException

toJson

public static JsonObject toJson(Object obj,
                                Class cls)
                         throws IllegalArgumentException,
                                IllegalAccessException,
                                InvocationTargetException
Convers an object to a simple (flat) json object. For depth, use the Converter with proper mappers

Parameters:
cls -
obj -
Returns:
Throws:
IllegalArgumentException
IllegalAccessException
InvocationTargetException

objectIntoJsonObject

public static boolean objectIntoJsonObject(JsonObject obj,
                                           String key,
                                           Object o)
Adds known simple types to the json object

Parameters:
obj -
key -
o -
Returns:
True if the object as of a simple type

objectIntoJsonArray

public static boolean objectIntoJsonArray(JsonArray arr,
                                          Object o)
Adds known simple types to the json array

Parameters:
obj -
key -
o -
Returns:
True if the object as of a simple type