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()org.kordamp.json.JSONArraygetJSONArray(org.kordamp.json.JSONObject json, String key)org.kordamp.json.JSONObjectgetJSONObject(org.kordamp.json.JSONObject json, String key)ObjectgetJSONValue(org.kordamp.json.JSONObject json, String key)Gets a raw object.booleangetJSONValueBoolean(org.kordamp.json.JSONObject json, String key)get a boolean value.intgetJSONValueInt(org.kordamp.json.JSONObject json, String key)longgetJSONValueLong(org.kordamp.json.JSONObject json, String key)StringgetJSONValueString(org.kordamp.json.JSONObject json, String key)booleanhasKey(org.kordamp.json.JSONObject json, String key)voidsetJSONValue(org.kordamp.json.JSONObject json, String key, Object value)
-
-
-
Constructor Detail
-
JSONUtil
public JSONUtil(String componentName)
-
-
Method Detail
-
getComponentName
public String getComponentName()
-
getJSONValue
public Object getJSONValue(org.kordamp.json.JSONObject json, String key)
Gets a raw object.- Parameters:
json-key-- Returns:
-
getJSONObject
public org.kordamp.json.JSONObject getJSONObject(org.kordamp.json.JSONObject json, String key)
-
getJSONArray
public org.kordamp.json.JSONArray getJSONArray(org.kordamp.json.JSONObject json, String key)
-
hasKey
public boolean hasKey(org.kordamp.json.JSONObject json, String key)
-
getJSONValueBoolean
public boolean getJSONValueBoolean(org.kordamp.json.JSONObject json, String key)get a boolean value. Returnsfalseif no such value.- Parameters:
json-key-- Returns:
-
getJSONValueLong
public long getJSONValueLong(org.kordamp.json.JSONObject json, String key)
-
getJSONValueInt
public int getJSONValueInt(org.kordamp.json.JSONObject json, String key)
-
-