com.novell.sentinel.json
Class JSONUtils
java.lang.Object
com.novell.sentinel.json.JSONUtils
public class JSONUtils
- extends Object
Utility class for creating and reading JSON data.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NULL
public static final String NULL
- See Also:
- Constant Field Values
TRUE
public static final String TRUE
- See Also:
- Constant Field Values
FALSE
public static final String FALSE
- See Also:
- Constant Field Values
OBJECT_START
public static final char OBJECT_START
- See Also:
- Constant Field Values
OBJECT_END
public static final char OBJECT_END
- See Also:
- Constant Field Values
ARRAY_START
public static final char ARRAY_START
- See Also:
- Constant Field Values
ARRAY_END
public static final char ARRAY_END
- See Also:
- Constant Field Values
PAIR_SEPARATOR
public static final char PAIR_SEPARATOR
- See Also:
- Constant Field Values
VALUE_SEPARATOR
public static final char VALUE_SEPARATOR
- See Also:
- Constant Field Values
STRING_DELIMITER
public static final char STRING_DELIMITER
- See Also:
- Constant Field Values
ESCAPE
public static final char ESCAPE
- See Also:
- Constant Field Values
JSONUtils
public JSONUtils()
setDateHandler
public static void setDateHandler(JSONDateHandler handler)
- Set the environment-dependent implementation of JSONDateHandler for use in serializing and
parsing Date values.
This method should only be called once at start up of the module using the JSONUtils class.
- Parameters:
handler
- The implementation.
getDateHandler
public static JSONDateHandler getDateHandler()
toJSON
public static String toJSON(String name,
String jsonValue)
toJSON
public static String toJSON(String value)
toJSON
public static String toJSON(boolean value)
toJSON
public static String toJSON(Boolean value)
toJSON
public static String toJSON(short value)
toJSON
public static String toJSON(Short value)
toJSON
public static String toJSON(char value)
toJSON
public static String toJSON(Character value)
toJSON
public static String toJSON(int value)
toJSON
public static String toJSON(Integer value)
toJSON
public static String toJSON(long value)
toJSON
public static String toJSON(Long value)
formatDate
public static String formatDate(Date value)
toJSON
public static String toJSON(Date value)
toJSON
public static String toJSON(boolean[] array)
toJSON
public static String toJSON(Boolean[] array)
stringFromJSON
public static String stringFromJSON(String jsonValue)
throws JSONUtils.JSONValueException
- Throws:
JSONUtils.JSONValueException
booleanFromJSON
public static boolean booleanFromJSON(String jsonValue)
throws JSONUtils.JSONValueException
- Throws:
JSONUtils.JSONValueException
booleanObjectFromJSON
public static Boolean booleanObjectFromJSON(String jsonValue)
throws JSONUtils.JSONValueException
- Throws:
JSONUtils.JSONValueException
shortFromJSON
public static short shortFromJSON(String jsonValue)
throws JSONUtils.JSONValueException
- Throws:
JSONUtils.JSONValueException
shortObjectFromJSON
public static Short shortObjectFromJSON(String jsonValue)
throws JSONUtils.JSONValueException
- Throws:
JSONUtils.JSONValueException
charFromJSON
public static char charFromJSON(String jsonValue)
throws JSONUtils.JSONValueException
- Throws:
JSONUtils.JSONValueException
charObjectFromJSON
public static Character charObjectFromJSON(String jsonValue)
throws JSONUtils.JSONValueException
- Throws:
JSONUtils.JSONValueException
intFromJSON
public static int intFromJSON(String jsonValue)
throws JSONUtils.JSONValueException
- Throws:
JSONUtils.JSONValueException
intObjectFromJSON
public static Integer intObjectFromJSON(String jsonValue)
throws JSONUtils.JSONValueException
- Throws:
JSONUtils.JSONValueException
longFromJSON
public static long longFromJSON(String jsonValue)
throws JSONUtils.JSONValueException
- Throws:
JSONUtils.JSONValueException
longObjectFromJSON
public static Long longObjectFromJSON(String jsonValue)
throws JSONUtils.JSONValueException
- Throws:
JSONUtils.JSONValueException
dateFromISOString
public static Date dateFromISOString(String value)
throws JSONUtils.JSONValueException
- Throws:
JSONUtils.JSONValueException
dateFromJSON
public static Date dateFromJSON(String jsonValue)
throws JSONUtils.JSONValueException
- Throws:
JSONUtils.JSONValueException