|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.pivot.json.JSON
public class JSON
Contains utility methods for working with JSON or JSON-like data structures.
Constructor Summary | |
---|---|
JSON()
|
Method Summary | |
---|---|
static boolean |
containsKey(Object root,
String path)
Tests the existence of a path in a given object. |
static Object |
get(Object root,
String path)
Returns the value at the given path. |
static Boolean |
getBoolean(Object root,
String path)
Returns the value at the given path as a boolean. |
static Double |
getDouble(Object root,
String path)
Returns the value at the given path as a double. |
static Float |
getFloat(Object root,
String path)
Returns the value at the given path as a float. |
static Integer |
getInteger(Object root,
String path)
Returns the value at the given path as an integer. |
static List<?> |
getList(Object root,
String path)
Returns the value at the given path as a list. |
static Long |
getLong(Object root,
String path)
Returns the value at the given path as a long. |
static Map<String,?> |
getMap(Object root,
String path)
Returns the value at the given path as a map. |
static Number |
getNumber(Object root,
String path)
Returns the value at the given path as a number. |
static Short |
getShort(Object root,
String path)
Returns the value at the given path as a short. |
static String |
getString(Object root,
String path)
Returns the value at the given path as a string. |
static Object |
put(Object root,
String path,
Object value)
Sets the value at the given path. |
static Object |
remove(Object root,
String path)
Removes the value at the given path. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JSON()
Method Detail |
---|
public static Object get(Object root, String path)
root
- The root object; must be an instance of Map
or List
.path
- The path to the value, in JavaScript path notation.
public static String getString(Object root, String path)
root
- path
- get(Object, String)
public static Number getNumber(Object root, String path)
root
- path
- get(Object, String)
public static Short getShort(Object root, String path)
root
- path
- get(Object, String)
public static Integer getInteger(Object root, String path)
root
- path
- get(Object, String)
public static Long getLong(Object root, String path)
root
- path
- get(Object, String)
public static Float getFloat(Object root, String path)
root
- path
- get(Object, String)
public static Double getDouble(Object root, String path)
root
- path
- get(Object, String)
public static Boolean getBoolean(Object root, String path)
root
- path
- get(Object, String)
public static List<?> getList(Object root, String path)
root
- path
- get(Object, String)
public static Map<String,?> getMap(Object root, String path)
root
- path
- get(Object, String)
public static Object put(Object root, String path, Object value)
root
- path
- value
-
public static Object remove(Object root, String path)
root
- path
-
public static boolean containsKey(Object root, String path)
root
- path
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |