Package com.openfin.desktop
Class JsonBean
java.lang.Object
com.openfin.desktop.JsonBean
- Direct Known Subclasses:
AcceleratorOptions
,ApiOptions
,ApplicationOptions
,AutoResizeOptions
,ButtonOptions
,ContentNavigationOptions
,Context
,ContextGroupInfo
,ContextMenuSettings
,CustomData
,DisplayMetadata
,FeedApplication
,FindInPageOptions
,Identity
,IFrameOptions
,Intent
,LayoutContentOptionsImpl
,LayoutOptions
,MonitorDetails
,MonitorInfo
,NotificationActionResult
,NotificationEvent
,NotificationIndicator
,NotificationOptions
,NotificationSourceDesktop
,NotificationSourceFeed
,PlatformSnapshot
,PlatformSnapshotDetails
,PlatformSnapshotOptions
,PlatformViewOptions
,PrinterInfo
,PrintOptions
,ProviderStatus
,WindowOptions
public class JsonBean
extends java.lang.Object
-
Field Summary
Fields Modifier and Type Field Description protected org.json.JSONObject
json
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description java.lang.Object
get(java.lang.String key)
org.json.JSONArray
getArray(java.lang.String name)
java.lang.Boolean
getBoolean(java.lang.String name)
boolean
getBooleanValue(java.lang.String property)
Helper method to extract data field from underlying JSONObjectboolean
getBooleanValue(java.lang.String property, boolean defaultValue)
Helper method to extract data field from underlying JSONObjectdouble
getDoubleValue(java.lang.String property)
Helper method to extract data field from underlying JSONObjectdouble
getDoubleValue(java.lang.String property, double defaultValue)
java.lang.Integer
getInteger(java.lang.String name)
int
getIntegerValue(java.lang.String property)
Helper method to extract data field from underlying JSONObjectorg.json.JSONObject
getJson()
Gets the underlying JSONObject<T> T
getJsonBean(java.lang.String name, java.lang.Class<T> clazz)
<T> T
getJsonBean(org.json.JSONObject obj, java.lang.Class<T> clazz)
<T extends JsonBean>
java.util.List<T>getJsonBeanList(java.lang.String name, java.lang.Class<T> clazz)
org.json.JSONObject
getJsonCopy()
Gets a copy of underlying JSONObjectorg.json.JSONObject
getJsonValue(java.lang.String property)
Helper method to extract data field from underlying JSONObject<T> java.util.List<T>
getList(java.lang.String name)
java.awt.Rectangle
getRectangle(java.lang.String name)
java.lang.String
getString(java.lang.String property)
Helper method to extract data field from underlying JSONObjectJsonBean
put(java.lang.String key, java.lang.Object value)
Set value for a property<T> void
setArray(java.lang.String name, java.util.Collection<T> value)
void
setBoolean(java.lang.String name, java.lang.Boolean value)
void
setInteger(java.lang.String name, java.lang.Integer value)
<T> void
setJsonArray(java.lang.String name, java.util.List<T> values)
<T extends JsonBean>
voidsetJsonBean(java.lang.String name, T jsonBean)
void
setLong(java.lang.String name, java.lang.Long value)
void
setRectangle(java.lang.String name, java.awt.Rectangle rect)
void
setString(java.lang.String name, java.lang.String value)
java.lang.String
toString()
-
Field Details
-
json
protected org.json.JSONObject json
-
-
Constructor Details
-
Method Details
-
getJson
public org.json.JSONObject getJson()Gets the underlying JSONObject- Returns:
- JSONObject
-
getJsonCopy
public final org.json.JSONObject getJsonCopy()Gets a copy of underlying JSONObject- Returns:
- JSONObject
-
getString
public java.lang.String getString(java.lang.String property)Helper method to extract data field from underlying JSONObject- Parameters:
property
- name of the field- Returns:
- String value of a field
-
getIntegerValue
public int getIntegerValue(java.lang.String property)Helper method to extract data field from underlying JSONObject- Parameters:
property
- name of the field- Returns:
- Integer value of a field
-
getDoubleValue
public double getDoubleValue(java.lang.String property)Helper method to extract data field from underlying JSONObject- Parameters:
property
- name of the field- Returns:
- Double value of a field
-
getDoubleValue
public double getDoubleValue(java.lang.String property, double defaultValue) -
getBooleanValue
public boolean getBooleanValue(java.lang.String property)Helper method to extract data field from underlying JSONObject- Parameters:
property
- name of the field- Returns:
- Boolean value of a field
-
getBooleanValue
public boolean getBooleanValue(java.lang.String property, boolean defaultValue)Helper method to extract data field from underlying JSONObject- Parameters:
property
- name of the fielddefaultValue
- default value if property is missing- Returns:
- Boolean value of a field
-
getJsonValue
public org.json.JSONObject getJsonValue(java.lang.String property)Helper method to extract data field from underlying JSONObject- Parameters:
property
- name of the field- Returns:
- JSONObject value of a field
-
put
Set value for a property- Parameters:
key
- name of the propertyvalue
- value- Returns:
- current object
- Throws:
org.json.JSONException
- from JSONObject.put
-
get
public java.lang.Object get(java.lang.String key) -
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-
getBoolean
public java.lang.Boolean getBoolean(java.lang.String name) -
setBoolean
public void setBoolean(java.lang.String name, java.lang.Boolean value) -
setString
public void setString(java.lang.String name, java.lang.String value) -
setArray
public <T> void setArray(java.lang.String name, java.util.Collection<T> value) -
getArray
public org.json.JSONArray getArray(java.lang.String name) -
getList
public <T> java.util.List<T> getList(java.lang.String name) -
setJsonArray
public <T> void setJsonArray(java.lang.String name, java.util.List<T> values) -
getJsonBeanList
public <T extends JsonBean> java.util.List<T> getJsonBeanList(java.lang.String name, java.lang.Class<T> clazz) -
getInteger
public java.lang.Integer getInteger(java.lang.String name) -
setInteger
public void setInteger(java.lang.String name, java.lang.Integer value) -
setLong
public void setLong(java.lang.String name, java.lang.Long value) -
getJsonBean
public <T> T getJsonBean(java.lang.String name, java.lang.Class<T> clazz) -
getJsonBean
public <T> T getJsonBean(org.json.JSONObject obj, java.lang.Class<T> clazz) -
setJsonBean
-
setRectangle
public void setRectangle(java.lang.String name, java.awt.Rectangle rect) -
getRectangle
public java.awt.Rectangle getRectangle(java.lang.String name)
-