Tea Java Runtime API
Version 3.2.4

com.pdmfc.tea.modules.tos
Class STosClass

java.lang.Object
  extended by com.pdmfc.tea.modules.tos.STosClass
Direct Known Subclasses:
SJavaClass

public class STosClass
extends java.lang.Object

This class implements a TOS class.


Field Summary
static SObjSymbol _constructName
           
 
Constructor Summary
STosClass()
          Defines a new TOS class with no base class and with no members.
STosClass(SList members)
          Defines a new TOS class with no base class.
STosClass(STosClass superClass)
          Defines a new TOS class with no members.
STosClass(STosClass superClass, SList members)
          Defines a new TOS class.
 
Method Summary
 void addConstructor(SObjFunction method)
          Associates a constructor with this TOS class.
 void addMethod(SObjSymbol methodName, SObjFunction method)
          Associates a new TOS method with this TOS class.
 void addMethod(java.lang.String methodName, SObjFunction method)
          Associates a new TOS method with this TOS class.
 SObjFunction getConstructor()
          Retrieves the STObjProc object that implements the constructor for this TOS class.
 SObjFunction getMethod(SObjSymbol methodName)
          Retrieves the SObjFunction object that implements the method referenced by the symbol methodName.
 java.lang.String getName()
          Fetches the name associated with the class.
 STosClass getSuperClass()
          Retrieves the TOS base class of this TOS class.
 int level()
          Retrieves the level of the TOS class definition down the hierarchy.
 SList memberNames()
          Retrieves the member names of this TOS class.
 STosObj newInstance()
          Creates a new instance of an object of this TOS class, but does not initialize the object.
 STosObj newInstance(SContext context, java.lang.Object[] args)
          Creates a new instance of an object of this TOS class.
 void setName(java.lang.String name)
          Associates a name with the class object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_constructName

public static final SObjSymbol _constructName
Constructor Detail

STosClass

public STosClass(STosClass superClass,
                 SList members)
Defines a new TOS class.

Parameters:
superClass - The base class of the class being defined. If it is null it means the class being defined has no base class.
members - Array with the member names. It must be a Vector of SObjSymbol objects.

STosClass

public STosClass(SList members)
Defines a new TOS class with no base class.

Parameters:
members - Array with the member names. It must be a Vector of SObjSymbol objects.
Throws:
com.pdmfc.tea.modules.tos.STosNoSuchClassException - Never thrown.

STosClass

public STosClass(STosClass superClass)
Defines a new TOS class with no members.

Parameters:
superClass - The base class of the class being defined. If it is null it means the class being defined has no base class.

STosClass

public STosClass()
Defines a new TOS class with no base class and with no members.

Method Detail

getSuperClass

public STosClass getSuperClass()
Retrieves the TOS base class of this TOS class.

Returns:
An STosClass object representing the TOS base class of this TOS class. If it is null it means it has no base class.

memberNames

public SList memberNames()
Retrieves the member names of this TOS class.

Returns:
An Enumeration that will iterate over all the member names. The Enumeration will always iterate over the members the same way.

level

public int level()
Retrieves the level of the TOS class definition down the hierarchy. A value of zero means it is a TOS class with no base class.

Returns:
A non-negative integer.

newInstance

public STosObj newInstance()
                    throws STeaException
Creates a new instance of an object of this TOS class, but does not initialize the object.

Returns:
A new STosObj object, representing a new instance of this class. The object will have to be initialized.
Throws:
STeaException - Not throws by this method. Only declared for derived classes that reimplement this method.

newInstance

public STosObj newInstance(SContext context,
                           java.lang.Object[] args)
                    throws STeaException
Creates a new instance of an object of this TOS class.

Parameters:
args - Array of argumens to be passed to the constructor. The first element in the array is not used. The second element should be a symbol with the class name of the object being instantiated.
Returns:
A new STosObj object, representing a new instance of this TOS class.
Throws:
STeaException

addMethod

public void addMethod(SObjSymbol methodName,
                      SObjFunction method)
Associates a new TOS method with this TOS class. If a method with the same name already existed then it is superceded by this new method.

Parameters:
methodName - A symbol standing for the name of the method being defined.
method - A reference to the SObjFunction object that implements the TOS method.

addMethod

public void addMethod(java.lang.String methodName,
                      SObjFunction method)
Associates a new TOS method with this TOS class.

The constructor for the object is a method with the same name as the class.

Parameters:
methodName - A symbol standing for the name of the method being defined.
method - A reference to the SObjFunction object that implements the TOS method.

addConstructor

public void addConstructor(SObjFunction method)
Associates a constructor with this TOS class.

Parameters:
method - A reference to the SObjFunction object that implements the constructor.

getMethod

public SObjFunction getMethod(SObjSymbol methodName)
                       throws SNoSuchMethodException
Retrieves the SObjFunction object that implements the method referenced by the symbol methodName. An exception is thrown if that method has not been defined for this class.

Returns:
The SObjFunction object that implements the specified method.
Throws:
com.pdmfc.tea.modules.tos.STosNoSuchMethodException - Thrown if the method had not been defined for this class.
SNoSuchMethodException

getConstructor

public SObjFunction getConstructor()
Retrieves the STObjProc object that implements the constructor for this TOS class.

The constructor is just a method with the same name as the TOS class.

Returns:
The STObjProc object that implements the TOS constructor. null if a constructor was not defined.

setName

public void setName(java.lang.String name)
Associates a name with the class object. A name can be associated to the class just for informational purposes. Currently this name is only used in error messages generated by the TOS class object. Note that there is no restriction on the contents of the name. There may even be more than one class with the same name.

Parameters:
name - The name that will be associated with the class.

getName

public java.lang.String getName()
Fetches the name associated with the class. This is the string passed to last call to the setName<(String) method.

Returns:
The name associated with the class.

Tea Java Runtime API
Version 3.2.4

© 2009 PDM&FC, All Rights Reserved.