visad.util
Class ReflectedUniverse
- java.lang.Object
-
- visad.util.ReflectedUniverse
-
public class ReflectedUniverse extends java.lang.ObjectA general-purpose reflection wrapper class. See visad.data.jai.JAIForm for examples of usage.
-
-
Constructor Summary
Constructors Constructor and Description ReflectedUniverse()Constructs a new reflected universe.ReflectedUniverse(java.lang.ClassLoader loader)Constructs a new reflected universe that uses the given class loader.ReflectedUniverse(java.net.URL[] urls)Constructs a new reflected universe, with the given URLs representing additional search paths for imported classes (in addition to the CLASSPATH).
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description java.lang.Objectexec(java.lang.String command)Executes a command in the universe.java.lang.ObjectgetVar(java.lang.String varName)Returns the value of a variable or field in the universe.booleanisDebug()Gets whether extended debugging output is enabled.static booleanisInstance(java.lang.Class c, java.lang.Object o)Returns whether the given object is compatible with the specified class for the purposes of reflection.voidsetDebug(boolean debug)Enables or disables extended debugging output.voidsetVar(java.lang.String varName, boolean b)Registers a variable of primitive type boolean in the universe.voidsetVar(java.lang.String varName, byte b)Registers a variable of primitive type byte in the universe.voidsetVar(java.lang.String varName, char c)Registers a variable of primitive type char in the universe.voidsetVar(java.lang.String varName, double d)Registers a variable of primitive type double in the universe.voidsetVar(java.lang.String varName, float f)Registers a variable of primitive type float in the universe.voidsetVar(java.lang.String varName, int i)Registers a variable of primitive type int in the universe.voidsetVar(java.lang.String varName, long l)Registers a variable of primitive type long in the universe.voidsetVar(java.lang.String varName, java.lang.Object obj)Registers a variable in the universe.voidsetVar(java.lang.String varName, short s)Registers a variable of primitive type short in the universe.
-
-
-
Constructor Detail
-
ReflectedUniverse
public ReflectedUniverse()
Constructs a new reflected universe.
-
ReflectedUniverse
public ReflectedUniverse(java.net.URL[] urls)
Constructs a new reflected universe, with the given URLs representing additional search paths for imported classes (in addition to the CLASSPATH).
-
ReflectedUniverse
public ReflectedUniverse(java.lang.ClassLoader loader)
Constructs a new reflected universe that uses the given class loader.
-
-
Method Detail
-
isInstance
public static 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 VisADExceptionExecutes 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.
-
setVar
public void setVar(java.lang.String varName, boolean b)Registers a variable of primitive type boolean in the universe.
-
setVar
public void setVar(java.lang.String varName, byte b)Registers a variable of primitive type byte in the universe.
-
setVar
public void setVar(java.lang.String varName, char c)Registers a variable of primitive type char in the universe.
-
setVar
public void setVar(java.lang.String varName, double d)Registers a variable of primitive type double in the universe.
-
setVar
public void setVar(java.lang.String varName, float f)Registers a variable of primitive type float in the universe.
-
setVar
public void setVar(java.lang.String varName, int i)Registers a variable of primitive type int in the universe.
-
setVar
public void setVar(java.lang.String varName, long l)Registers a variable of primitive type long in the universe.
-
setVar
public void setVar(java.lang.String varName, short s)Registers a variable of primitive type short in the universe.
-
getVar
public java.lang.Object getVar(java.lang.String varName) throws VisADExceptionReturns the value of a variable or field in the universe. Primitive types will be wrapped in their Java Object wrapper classes.- Throws:
VisADException
-
setDebug
public void setDebug(boolean debug)
Enables or disables extended debugging output.
-
isDebug
public boolean isDebug()
Gets whether extended debugging output is enabled.
-
-
DMelt 3.0 © DataMelt by jWork.ORG