Class JSONUtil
- java.lang.Object
-
- org.oa4mp.delegation.common.storage.JSONUtil
-
public class JSONUtil extends Object
Budding collection of useful tools for creating complex JSON objects.The structure of a JSON serialization is {name:{key0:val0,...}} where name is the name of the component e.g. client, admin, ldap,... etc. So this lets you create a JSON object that has a single JSON object as its value and directly do set/get against the value object.
Created by Jeff Gaynor
on 11/14/16 at 2:12 PM
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getComponentName()
net.sf.json.JSONArray
getJSONArray(net.sf.json.JSONObject json, String key)
Object
getJSONValue(net.sf.json.JSONObject json, String key)
boolean
getJSONValueBoolean(net.sf.json.JSONObject json, String key)
get a boolean value.int
getJSONValueInt(net.sf.json.JSONObject json, String key)
long
getJSONValueLong(net.sf.json.JSONObject json, String key)
String
getJSONValueString(net.sf.json.JSONObject json, String key)
boolean
hasKey(net.sf.json.JSONObject json, String key)
void
setJSONValue(net.sf.json.JSONObject json, String key, Object value)
-
-
-
Constructor Detail
-
JSONUtil
public JSONUtil(String componentName)
-
-
Method Detail
-
getComponentName
public String getComponentName()
-
getJSONArray
public net.sf.json.JSONArray getJSONArray(net.sf.json.JSONObject json, String key)
-
hasKey
public boolean hasKey(net.sf.json.JSONObject json, String key)
-
getJSONValueBoolean
public boolean getJSONValueBoolean(net.sf.json.JSONObject json, String key)
get a boolean value. Returnsfalse
if no such value.- Parameters:
json
-key
-- Returns:
-
getJSONValueLong
public long getJSONValueLong(net.sf.json.JSONObject json, String key)
-
getJSONValueInt
public int getJSONValueInt(net.sf.json.JSONObject json, String key)
-
-