spark.data
Interface SO

All Superinterfaces:
SParented
All Known Implementing Classes:
SObj, SOReflect

public interface SO
extends SParented

This defines the object interface for all objects in the Spark data model. Objects consist of attribute name/value pairs. Spark deviates slightly from JavaScript and JSON in that names must be valid identifiers that start with a letter or an underscore.

The primary access to SO objects is the getting and setting of attribute values. It is also possible to get access to all of the attribute names of an object.

Spark objects also have a class name. In the Java implementation, this is the full class name used to implement the object.

Because Spark objects are frequently part of trees and it is frequently necessary to find the way back to the root of the tree. For this reason a mechanism for accessing a parent is provided. Many data structures are not part of trees and have no parent, in which cases this can be null.

Author:
olsen

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.
 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)
           
 
Methods inherited from interface spark.data.SParented
myParent, newParent
 

Method Detail

myClass

java.lang.String myClass()
This returns the name of the class that implements this object.

Returns:
a full class name

get

SV get(java.lang.String name)
This will return the value of the named attribute.

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.

getLong

long getLong(java.lang.String name)

getDouble

double getDouble(java.lang.String name)

isTrue

boolean isTrue(java.lang.String name)

getString

java.lang.String getString(java.lang.String name)

getObj

SO getObj(java.lang.String name)

getArray

SA getArray(java.lang.String name)

set

void set(java.lang.String name,
         SV value)
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.

Parameters:
name - the name of the attribute to be set.
value - the new value for the attribute.

set

void set(java.lang.String name,
         long value)

set

void set(java.lang.String name,
         double value)

set

void set(java.lang.String name,
         boolean value)

set

void set(java.lang.String name,
         java.lang.String value)

set

void set(java.lang.String name,
         SO value)

set

void set(java.lang.String name,
         SA value)

setNull

void setNull(java.lang.String name)

attributes

java.lang.String[] attributes()
This will retrieve the names of all of the attributes that are available for this object.

Returns:
an array of attribute names.