org.omegahat.Interfaces.NativeInterface
Class InterfaceReference

java.lang.Object
  |
  +--org.omegahat.Interfaces.NativeInterface.InterfaceReference
All Implemented Interfaces:
org.omegahat.Environment.Language.Evaluable
Direct Known Subclasses:
AnonymousReference, NamedReference

public abstract class InterfaceReference
extends java.lang.Object
implements org.omegahat.Environment.Language.Evaluable

The base class for the two reference objects, anonymous and named, used to store objects created in Java and passed back to other applications such as and via the JNI, avoiding conversion and available for reuse in further expressions/calls.

This allows us to maintain references to Java objects from within these systems that can be used in other calls. Unnecessary conversion of arbitrary Java objects to structures in these other languages can be avoided. We would otherwise either have to specify methods to map each Java class to a corresponding structure in S/R. Otherwise, we could use a deep copy of the Java object's fields to an S/R list.

See Also:
NamedReference, AnonymousReference

Field Summary
protected  java.lang.String className
           
protected  org.omegahat.Environment.Databases.Database database
          The database in which the object identified by the key lives.
protected  java.lang.String key
          The name of the entry in the database which this object identifies.
protected  OmegaInterfaceManager manager
          The interface manager in which the object was created and resides.
 
Constructor Summary
InterfaceReference()
           
InterfaceReference(java.lang.String key, OmegaInterfaceManager manager)
          Create the reference for the given name using the specified manager and its default database.
InterfaceReference(java.lang.String key, OmegaInterfaceManager manager, org.omegahat.Environment.Databases.Database db)
          Create the reference for the object named by key in the specified database (either the named or anonymous database) associated with the given InterfaceManager
InterfaceReference(java.lang.String key, OmegaInterfaceManager manager, org.omegahat.Environment.Databases.Database db, java.lang.String className)
           
 
Method Summary
 org.omegahat.Environment.Databases.Database database()
          The Database in which the referenced object resides.
 org.omegahat.Environment.Databases.Database database(org.omegahat.Environment.Databases.Database db)
          Store the Database in which the referenced object lives.
 java.lang.Object eval(org.omegahat.Environment.Interpreter.Evaluator evaluator)
          Evaluate the reference object, returning the value to which it refers.
 java.lang.Object eval(java.lang.Object[] args, org.omegahat.Environment.Interpreter.Evaluator evaluator)
           
 java.lang.String getClassName()
          Accessor for className field
 java.lang.String key()
          Retrieve the name of the object to which this object refers.
 java.lang.String key(java.lang.String v)
          Set the name of the object being referenced by this object.
 OmegaInterfaceManager manager()
          The interface manager
 OmegaInterfaceManager manager(OmegaInterfaceManager m)
           
 java.lang.String setClassName(java.lang.String name)
          Accessor for className field
 java.lang.String toString()
          Show the key as a pointer to some other object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

key

protected java.lang.String key
The name of the entry in the database which this object identifies.

database

protected org.omegahat.Environment.Databases.Database database
The database in which the object identified by the key lives.
See Also:
key

manager

protected OmegaInterfaceManager manager
The interface manager in which the object was created and resides.

className

protected java.lang.String className
Constructor Detail

InterfaceReference

public InterfaceReference()

InterfaceReference

public InterfaceReference(java.lang.String key,
                          OmegaInterfaceManager manager)
Create the reference for the given name using the specified manager and its default database.
Parameters:
key - name of the object being referenced
manager - interface manager in which the object resides, specifically in the default database.

InterfaceReference

public InterfaceReference(java.lang.String key,
                          OmegaInterfaceManager manager,
                          org.omegahat.Environment.Databases.Database db)
Create the reference for the object named by key in the specified database (either the named or anonymous database) associated with the given InterfaceManager
Parameters:
key - the name of the object referenced by this object
manager - the interface manager in which the object is created and connected with the database
db - the database, either the named or anonymous, associated with the InterfaceManager.

InterfaceReference

public InterfaceReference(java.lang.String key,
                          OmegaInterfaceManager manager,
                          org.omegahat.Environment.Databases.Database db,
                          java.lang.String className)
Method Detail

toString

public java.lang.String toString()
Show the key as a pointer to some other object.
Overrides:
toString in class java.lang.Object

key

public java.lang.String key()
Retrieve the name of the object to which this object refers. This can be used with the result of database() to get the actual object.

key

public java.lang.String key(java.lang.String v)
Set the name of the object being referenced by this object.

manager

public OmegaInterfaceManager manager()
The interface manager

manager

public OmegaInterfaceManager manager(OmegaInterfaceManager m)

database

public org.omegahat.Environment.Databases.Database database()
The Database in which the referenced object resides.

database

public org.omegahat.Environment.Databases.Database database(org.omegahat.Environment.Databases.Database db)
Store the Database in which the referenced object lives.

getClassName

public java.lang.String getClassName()
Accessor for className field

setClassName

public java.lang.String setClassName(java.lang.String name)
Accessor for className field

eval

public java.lang.Object eval(org.omegahat.Environment.Interpreter.Evaluator evaluator)
                      throws java.lang.Throwable
Evaluate the reference object, returning the value to which it refers.
Specified by:
eval in interface org.omegahat.Environment.Language.Evaluable

eval

public java.lang.Object eval(java.lang.Object[] args,
                             org.omegahat.Environment.Interpreter.Evaluator evaluator)
                      throws java.lang.Throwable
Specified by:
eval in interface org.omegahat.Environment.Language.Evaluable