com.extentech.ExtenBean
Class JSONDataObject

java.lang.Object
  extended by com.extentech.ExtenBean.JSONDataObject
All Implemented Interfaces:
SimpleDataObject, Serializable

public class JSONDataObject
extends Object
implements SimpleDataObject

A DataObject implementation which uses JSON (Java Script Object Notation) data.

Version:
1.1
Author:
John McMahon -- Copyright ©2011Extentech Inc.
See Also:
JSONDataObjectFactory, DataObject, colinfo, Serialized Form

Constructor Summary
JSONDataObject(org.json.JSONArray j)
           
 
Method Summary
 colinfo[] getColinfo()
          Returns the column metadata for this row of data.
 colinfo getColinfoByName(String colname)
           
 List getColNames()
          return the JSON Array Ojbect field names
 SimpleDataObject getDataObject(int x)
          get a new DataObject from this one
 Object[] getDataRow(int i)
          Get the data fields as an array of objects.
 org.json.JSONArray getDelegate()
           
 boolean getIsMultiple()
           
 int getNumRows()
           
 Object getOriginalKey()
           
 String getStringVal(int idx, String col)
           
 String getStringVal(String col)
           
 Object getVal(int idx, String col)
           
 Object getVal(String field)
           
 Object getValForNode(String field)
           
 void init()
           
 void initNode(int idx, JSONDataObject dobj)
          more or less clone this node, except as a singleton
 boolean isNew()
           
 void load()
          get whether or not to cascade the updates to child dataobjects
 void remove()
           
 void setDelegate(org.json.JSONArray delegate)
           
 void setVal(int row, String col, Object val)
           
 void setVal(String col, Object val)
           
 void store()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JSONDataObject

public JSONDataObject(org.json.JSONArray j)
Method Detail

getOriginalKey

public Object getOriginalKey()

getValForNode

public Object getValForNode(String field)

init

public void init()

getDataObject

public SimpleDataObject getDataObject(int x)
get a new DataObject from this one

Specified by:
getDataObject in interface SimpleDataObject

initNode

public void initNode(int idx,
                     JSONDataObject dobj)
more or less clone this node, except as a singleton


getColinfo

public colinfo[] getColinfo()
Description copied from interface: SimpleDataObject
Returns the column metadata for this row of data.

Specified by:
getColinfo in interface SimpleDataObject
Returns:
An array of colinfo objects containing

getColinfoByName

public colinfo getColinfoByName(String colname)
Specified by:
getColinfoByName in interface SimpleDataObject

getColNames

public List getColNames()
return the JSON Array Ojbect field names

Specified by:
getColNames in interface SimpleDataObject
Returns:
See Also:
com.extentech.ExtenBean.SimpleDataObject#getColnames()

getDelegate

public org.json.JSONArray getDelegate()
Returns:
Returns the delegate.

setDelegate

public void setDelegate(org.json.JSONArray delegate)
Parameters:
delegate - The delegate to set.

getDataRow

public Object[] getDataRow(int i)
Description copied from interface: SimpleDataObject
Get the data fields as an array of objects. Type information is contained in the colinfo for this object.

Specified by:
getDataRow in interface SimpleDataObject
Returns:
An array of values from a database

getIsMultiple

public boolean getIsMultiple()
Specified by:
getIsMultiple in interface SimpleDataObject

getNumRows

public int getNumRows()
Specified by:
getNumRows in interface SimpleDataObject

getStringVal

public String getStringVal(int idx,
                           String col)
Specified by:
getStringVal in interface SimpleDataObject

getStringVal

public String getStringVal(String col)
Specified by:
getStringVal in interface SimpleDataObject

getVal

public Object getVal(String field)
Specified by:
getVal in interface SimpleDataObject

getVal

public Object getVal(int idx,
                     String col)
Specified by:
getVal in interface SimpleDataObject

isNew

public boolean isNew()
Specified by:
isNew in interface SimpleDataObject

load

public void load()
          throws Exception
Description copied from interface: SimpleDataObject
get whether or not to cascade the updates to child dataobjects

Specified by:
load in interface SimpleDataObject
Throws:
Exception

remove

public void remove()
            throws Exception
Specified by:
remove in interface SimpleDataObject
Throws:
Exception

setVal

public void setVal(String col,
                   Object val)
Specified by:
setVal in interface SimpleDataObject

setVal

public void setVal(int row,
                   String col,
                   Object val)
Specified by:
setVal in interface SimpleDataObject

store

public void store()
           throws Exception
Specified by:
store in interface SimpleDataObject
Throws:
Exception


Copyright © 2011 Extentech Inc. All Rights Reserved.