tcl.pkg.java
Class ReflectObject

java.lang.Object
  extended by tcl.pkg.java.ReflectObject
All Implemented Interfaces:
Command, CommandWithDispose, InternalRep

public class ReflectObject
extends Object
implements InternalRep, CommandWithDispose

A ReflectObject is used to create and access arbitrary Java objects using the Java Reflection API. It wraps around a Java object (i.e., an instance of any Java class) and expose it to Tcl scripts. The object is registered inside the interpreter and is given a string name. Tcl scripts can manipulate this object as long as the the reference count of the object is greater than zero.


Field Summary
protected static String CMD_PREFIX
           
protected static String NOCONVERT
           
 
Constructor Summary
ReflectObject()
           
 
Method Summary
 void cmdProc(Interp interp, TclObject[] argv)
          This method implements the functionality of the command.
 void dispose()
           
 void disposeCmd()
          Called when the interpreter is removing the Tcl command
static void dump(Interp interp)
           
 InternalRep duplicate()
           
static Object get(Interp interp, TclObject tobj)
           
static Class getClass(Interp interp, TclObject tobj)
           
static TclObject newInstance(Interp interp, Class cl, Object obj)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NOCONVERT

protected static final String NOCONVERT
See Also:
Constant Field Values

CMD_PREFIX

protected static final String CMD_PREFIX
See Also:
Constant Field Values
Constructor Detail

ReflectObject

public ReflectObject()
Method Detail

dump

public static void dump(Interp interp)

dispose

public void dispose()
Specified by:
dispose in interface InternalRep

duplicate

public InternalRep duplicate()
Specified by:
duplicate in interface InternalRep

newInstance

public static TclObject newInstance(Interp interp,
                                    Class cl,
                                    Object obj)
                             throws TclException
Throws:
TclException

get

public static Object get(Interp interp,
                         TclObject tobj)
                  throws TclException
Throws:
TclException

getClass

public static Class getClass(Interp interp,
                             TclObject tobj)
                      throws TclException
Throws:
TclException

cmdProc

public void cmdProc(Interp interp,
                    TclObject[] argv)
             throws TclException
Description copied from interface: Command
This method implements the functionality of the command. However, calling it directly in application code will bypass execution traces. Instead, commands should be called with WrappedCommand.invoke

Specified by:
cmdProc in interface Command
Parameters:
interp - The interpreter for setting the results and which contains the context
argv - the argument list for the command; objv[0[ is the command name itself
Throws:
TclException - on any errors

disposeCmd

public void disposeCmd()
Description copied from interface: CommandWithDispose
Called when the interpreter is removing the Tcl command

Specified by:
disposeCmd in interface CommandWithDispose

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2015. All rights reserved.