spark.data
Class SObj

java.lang.Object
  extended by spark.data.SObj
All Implemented Interfaces:
SO, SParented
Direct Known Subclasses:
SOReflect

public class SObj
extends java.lang.Object
implements SO

This is a concrete implementation of SO. It will dynamically contain any number of attribute/value pairs.

Author:
olsen

Constructor Summary
SObj()
           
 
Method Summary
 java.lang.String[] attributes()
          This will retrieve the names of all of the attributes that are available for this object.
 SV get(java.lang.String name)
          This will return the value of the named attribute.
 SA getArray(java.lang.String name)
           
 double getDouble(java.lang.String name)
           
 long getLong(java.lang.String name)
           
 SO getObj(java.lang.String name)
           
 java.lang.String getString(java.lang.String name)
           
 boolean isTrue(java.lang.String name)
           
 java.lang.String myClass()
          This returns the name of the class that implements this object.
 SParented myParent()
          Returns the parent of this object, if this object is part of a tree.
 void newParent(SParented newParent)
          changes the parent of this object.
 void set(java.lang.String name, boolean value)
           
 void set(java.lang.String name, double value)
           
 void set(java.lang.String name, long value)
           
 void set(java.lang.String name, SA value)
           
 void set(java.lang.String name, SO value)
           
 void set(java.lang.String name, java.lang.String value)
           
 void set(java.lang.String name, SV value)
          This will set the value of the named attribute.
 void setNull(java.lang.String name)
           
protected  void unParent(java.lang.String name)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SObj

public SObj()
Method Detail

myClass

public java.lang.String myClass()
Description copied from interface: SO
This returns the name of the class that implements this object.

Specified by:
myClass in interface SO
Returns:
a full class name

get

public SV get(java.lang.String name)
Description copied from interface: SO
This will return the value of the named attribute.

Specified by:
get in interface SO
Parameters:
name - the name of the attribute value to be returned.
Returns:
The value of the attribute. If this object does not have this attribute, then null will be returned.

unParent

protected void unParent(java.lang.String name)

set

public void set(java.lang.String name,
                SV value)
Description copied from interface: SO
This will set the value of the named attribute. If it is not possible to set this attribute then a RuntimeException is thrown. This can be used to create new attributes or to change them.

Specified by:
set in interface SO
Parameters:
name - the name of the attribute to be set.
value - the new value for the attribute.

attributes

public java.lang.String[] attributes()
Description copied from interface: SO
This will retrieve the names of all of the attributes that are available for this object.

Specified by:
attributes in interface SO
Returns:
an array of attribute names.

getLong

public long getLong(java.lang.String name)
Specified by:
getLong in interface SO

getDouble

public double getDouble(java.lang.String name)
Specified by:
getDouble in interface SO

isTrue

public boolean isTrue(java.lang.String name)
Specified by:
isTrue in interface SO

getString

public java.lang.String getString(java.lang.String name)
Specified by:
getString in interface SO

getObj

public SO getObj(java.lang.String name)
Specified by:
getObj in interface SO

getArray

public SA getArray(java.lang.String name)
Specified by:
getArray in interface SO

set

public void set(java.lang.String name,
                long value)
Specified by:
set in interface SO

set

public void set(java.lang.String name,
                double value)
Specified by:
set in interface SO

set

public void set(java.lang.String name,
                boolean value)
Specified by:
set in interface SO

set

public void set(java.lang.String name,
                java.lang.String value)
Specified by:
set in interface SO

set

public void set(java.lang.String name,
                SO value)
Specified by:
set in interface SO

set

public void set(java.lang.String name,
                SA value)
Specified by:
set in interface SO

setNull

public void setNull(java.lang.String name)
Specified by:
setNull in interface SO

myParent

public SParented myParent()
Description copied from interface: SParented
Returns the parent of this object, if this object is part of a tree. This has been named so as not to interfere with the get/set method patterns used by SOReflect

Specified by:
myParent in interface SParented
Returns:
the parent object.

newParent

public void newParent(SParented newParent)
Description copied from interface: SParented
changes the parent of this object. This has been named so as not to interfere with the get/set method patterns used by SObjReflect.

Specified by:
newParent in interface SParented
Parameters:
newParent - the new parent object.