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

    Constructors 
    Constructor Description
    JsonBean()  
    JsonBean​(org.json.JSONObject json)  
  • 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 JSONObject
    boolean getBooleanValue​(java.lang.String property, boolean defaultValue)
    Helper method to extract data field from underlying JSONObject
    double getDoubleValue​(java.lang.String property)
    Helper method to extract data field from underlying JSONObject
    double 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 JSONObject
    org.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 JSONObject
    org.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 JSONObject
    JsonBean 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>
    void
    setJsonBean​(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()  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • json

      protected org.json.JSONObject json
  • Constructor Details

    • JsonBean

      public JsonBean()
    • JsonBean

      public JsonBean​(org.json.JSONObject json)
  • 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 field
      defaultValue - 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

      public JsonBean put​(java.lang.String key, java.lang.Object value) throws org.json.JSONException
      Set value for a property
      Parameters:
      key - name of the property
      value - 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 class java.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

      public <T extends JsonBean> void setJsonBean​(java.lang.String name, T jsonBean)
    • setRectangle

      public void setRectangle​(java.lang.String name, java.awt.Rectangle rect)
    • getRectangle

      public java.awt.Rectangle getRectangle​(java.lang.String name)