aspoev.interpreter.base
Class MetaObject

java.lang.Object
  extended byaspoev.interpreter.base.MetaObject
All Implemented Interfaces:
pJ.jasmine.PRI, java.io.Serializable
Direct Known Subclasses:
CompositeObject, DatabaseObject, FieldMask

public class MetaObject
extends java.lang.Object
implements pJ.jasmine.PRI

This class is more or less just a map for instance variable members. A MetaObject is an 'instance' of a ClassDeclarationElement. However, since classes inevitably change in a schema evolution scenario, the MetaObject is not bound to any one Class Declaration, or class definition. A MetaObject has two types, an active type (the type it is being used as at the moment) and its declaration type (the type it was assigned on creation), and therefore has some knowledge about how itshould be treated. It does not know about which fields it does or does not have - Its final behavior is decided by the Class Declaration determined by it's type. In practice, this metaobject could be viewed as an object of any type, though type checking would not allow this.

See Also:
Serialized Form

Field Summary
protected  TypeReferenceElement declarationType
           
protected  TypeReferenceElement type
           
 
Fields inherited from interface pJ.jasmine.PRI
DELETECHANGE, MODIFYCHANGE, NOCHANGE
 
Constructor Summary
MetaObject()
           
MetaObject(TypeReferenceElement type)
           
 
Method Summary
 boolean equals(java.lang.Object other)
           
 ClassDeclarationElement getClassDeclaration()
          Returns the meta class that this meta object is an instance of.
 java.util.Collection getFieldNames()
          Returns a collection of the names of all fields defined on this object.
 TypeReferenceElement getFieldType(java.lang.String fieldName)
          Returns the type of the specfied field.
 java.lang.Object getFieldValue(java.lang.String fieldName)
          Either a number (Double), a string (String), an object (MetaObject), or a reference (VariableReferenceElement).
 boolean hasField(java.lang.String name)
          Returns true if this object has a field of the specified name.
 void setFieldValue(java.lang.String fieldName, java.lang.Object value)
          Sets the value of the specified field to the specified value.
 java.lang.String toLongString()
          Returns an extended String representation of the object
 java.lang.String toLongString(int level)
          Returns an extended String representation of the object, indented to the specified level.
 java.lang.String toShortString()
          Returns a short description of the object.
 java.lang.String toString()
          Returns a string description of the object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

declarationType

protected TypeReferenceElement declarationType

type

protected TypeReferenceElement type
Constructor Detail

MetaObject

public MetaObject()

MetaObject

public MetaObject(TypeReferenceElement type)
Method Detail

equals

public boolean equals(java.lang.Object other)

getClassDeclaration

public ClassDeclarationElement getClassDeclaration()
Returns the meta class that this meta object is an instance of.


getFieldNames

public java.util.Collection getFieldNames()
Returns a collection of the names of all fields defined on this object.


getFieldType

public TypeReferenceElement getFieldType(java.lang.String fieldName)
                                  throws java.lang.Exception
Returns the type of the specfied field.

Throws:
java.lang.Exception

getFieldValue

public java.lang.Object getFieldValue(java.lang.String fieldName)
                               throws java.lang.Exception
Either a number (Double), a string (String), an object (MetaObject), or a reference (VariableReferenceElement).

Throws:
java.lang.Exception

hasField

public boolean hasField(java.lang.String name)
Returns true if this object has a field of the specified name.


setFieldValue

public void setFieldValue(java.lang.String fieldName,
                          java.lang.Object value)
                   throws java.lang.Exception
Sets the value of the specified field to the specified value.

Throws:
java.lang.Exception

toLongString

public java.lang.String toLongString()
Returns an extended String representation of the object


toLongString

public java.lang.String toLongString(int level)
Returns an extended String representation of the object, indented to the specified level.


toShortString

public java.lang.String toShortString()
Returns a short description of the object.


toString

public java.lang.String toString()
Returns a string description of the object. (Same as 'toLongString')