On Wed, 21 Apr 1999, Thomas McKay wrote:
> Hi!
>
> In my Jacl application, users may write Tcl scripts to manipulate
> database objects:
>
> prompt% set o [createRect 0 0 20 30]
> java0xcf
I am not sure if this is exactly what you are asking but there is a
new feature/bug fix in Jacl 1.2.2 which lets you rename the java0x
instance command to something else (like rect0x or whatever).
> However, if a script is to be written that is associated with a specific
> object, then that objects id (the java0xcf name) must be persistent and
> stored when the db is saved. What I envision working well is:
>
> prompt% set o [createRect 0 0 20 30]
> rect0x01
No! This could cause some severe problems. When you call
ReflectObject.newInstance(Interp,Class,Object) the class
argument should not be passed by calling Object.getClass().
There is a description of why this is wrong an what can go
wrong in the new 1.2.2 documentation for the ReflectObject
class.
> Where the Java code would be something like:
>
> tclObject = ReflectObject.newInstance( interp,
> obj.getClass(), obj );
> tclObject.setRefID( "rect" + getNextCounter() );
As stated above, you could simply rename the reflect object instance
name from java0x1 to rect0x1 and things should work just fine. That
way the reference would be stored in the reflect table and all you
will need to do is keep a "next id" number for the number of rectangle
objects you have created so far. You could also just skip that by
using the 0x... part from the reflect object instance command as
those are unique.
later
mo dejong
dejong at cs.umn.edu
> Thus when the rectangle object is saved to the db, the reflect object
> name ("rect0x01") could be saved with it. Is there a way to do this?
>
> By setting the ReflectObject's name, different objects could be swapped
> in and out for the same reflect name.
>
> Any thoughts on how best to do this within the scope of Jacl? Of course
> I can always make my own mapping for my objects, but I'd like to first
> try to stay within Jacl.
>
> Tom
>
>
----------------------------------------------------------------
The TclJava mailing list is sponsored by WebNet Technologies.
To subscribe: send mail to [EMAIL PROTECTED]
with the word SUBSCRIBE as the subject.
To unsubscribe: send mail to [EMAIL PROTECTED]
with the word UNSUBSCRIBE as the subject.
To send to the list, send email to '[EMAIL PROTECTED]'.
A list archive is at: http://www.findmail.com/listsaver/tcldallas/