  CLASS
    tcl.lang.ReflectObject -- This class is used to reference Java objects.
  EXTENDS
    tcl.lang.InternalRep
  METHODS
    static TclObject newInstance(Object javaObj)
    static Object get(Interp interp, TclObject tobj)
  ARGUMENTS
  DESCRIPTION
    newInstance
    get
  SEE ALSO
  KEYWORDS

### CLASS

tcl.lang.ReflectObject -- This class is used to reference Java objects.

### EXTENDS

tcl.lang.InternalRep

### METHODS

static TclObject newInstance(Object javaObj)

static Object get(Interp interp, TclObject tobj)

### ARGUMENTS

Object javaObj ()
  Java Object to wrap into a TclObject.

Interp interp ()
  If tobj is not a valid TclObject, an error message is left in the interpreter's result object unless interp is NULL.

TclObject tobj ()
  TclObject from which to extract the Java Object.

### DESCRIPTION

This class is used to create and access arbitrary Java objects using the Java Reflection API. It wraps a Java object (i.e., an instance of any Java class) in a handle and exposes the handle 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.

newInstance
  The newInstance method creates an object handle to javaObj. The object handle can later be used to access javaObj via the java::* commands. This method is normally used to pass Java object to Tcl scripts. For example, a command procedure can return an object handle to Tcl scripts by executing the following:

      Object obj_to_return;
      interp.setResult(ReflectObject.newInstance(interp, obj_to_return));

  The object handle returned by this method is only valid in the given interpreter, interp.

get
  The get method returns the Java Object stored inside tobj. The tobj argument must contain a valid object handle, otherwise an error is reported.

### SEE ALSO

InternalRep, java, TclObject, TclList, TclString, TclInteger, TclBoolean, TclDouble

### KEYWORDS

reflect object, internal representation, object, object type

    Copyright © 1996-1998 Sun Microsystems, Inc.
    Copyright © 1995-1997 Roger E. Critchlow Jr.