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 StringgetComponentName()net.sf.json.JSONArraygetJSONArray(net.sf.json.JSONObject json, String key)net.sf.json.JSONObjectgetJSONObject(net.sf.json.JSONObject json, String key)ObjectgetJSONValue(net.sf.json.JSONObject json, String key)Gets a raw object.booleangetJSONValueBoolean(net.sf.json.JSONObject json, String key)get a boolean value.intgetJSONValueInt(net.sf.json.JSONObject json, String key)longgetJSONValueLong(net.sf.json.JSONObject json, String key)StringgetJSONValueString(net.sf.json.JSONObject json, String key)booleanhasKey(net.sf.json.JSONObject json, String key)voidsetJSONValue(net.sf.json.JSONObject json, String key, Object value)
-
-
-
Constructor Detail
-
JSONUtil
public JSONUtil(String componentName)
-
-
Method Detail
-
getComponentName
public String getComponentName()
-
getJSONValue
public Object getJSONValue(net.sf.json.JSONObject json, String key)
Gets a raw object.- Parameters:
json-key-- Returns:
-
getJSONObject
public net.sf.json.JSONObject getJSONObject(net.sf.json.JSONObject json, String key)
-
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. Returnsfalseif 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)
-
-