net.sourceforge.javajson.converter
Class Utils
java.lang.Object
net.sourceforge.javajson.converter.Utils
public class Utils
- extends Object
Constructor Summary |
Utils()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
dateFormat
public static DateFormat dateFormat
Utils
public Utils()
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