visad.util
Class ReflectedUniverse

java.lang.Object
  extended by visad.util.ReflectedUniverse

public class ReflectedUniverse
extends java.lang.Object

A general-purpose reflection wrapper class. See visad.data.tiff.TiffForm, visad.data.jai.JAIForm, and visad.data.qt.QTForm for examples of usage.


Constructor Summary
ReflectedUniverse()
           
 
Method Summary
 java.lang.Object exec(java.lang.String command)
          Executes a command in the universe.
 java.lang.Object getVar(java.lang.String varName)
          Returns the value of a variable or field in the universe.
protected  boolean isInstance(java.lang.Class c, java.lang.Object o)
          Returns whether the given object is compatible with the specified class for the purposes of reflection.
 void setVar(java.lang.String varName, java.lang.Object obj)
          Registers a variable in the universe.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReflectedUniverse

public ReflectedUniverse()
Method Detail

isInstance

protected boolean isInstance(java.lang.Class c,
                             java.lang.Object o)
Returns whether the given object is compatible with the specified class for the purposes of reflection.


exec

public java.lang.Object exec(java.lang.String command)
                      throws VisADException
Executes a command in the universe. The following syntaxes are valid:
  • import fully.qualified.package.ClassName
  • var = new ClassName(param1, ..., paramN)
  • var.method(param1, ..., paramN)
  • var2 = var1.method(param1, ..., paramN)
  • ClassName.method(param1, ..., paramN)

    Important guidelines:

  • Any referenced class must be imported first using "import".
  • Variables can be exported from the universe with getVar().
  • Variables can be imported to the universe with setVar().
  • Each parameter must be either a variable in the universe or a static or instance field (i.e., no nested methods).

    Throws:
    VisADException

  • setVar

    public void setVar(java.lang.String varName,
                       java.lang.Object obj)
    Registers a variable in the universe.


    getVar

    public java.lang.Object getVar(java.lang.String varName)
                            throws VisADException
    Returns the value of a variable or field in the universe.

    Throws:
    VisADException