Java Conversions


About:

Any command that returns a Java object or primitive Java type will automatically convert the object or primitive type to a corresponding Tcl value. This conversion can be skipped by using the -noconvert option. This applies to the java::call, java::field, java::prop, javaObj, and javaArrayObj commands. The java::new command does not do any conversion because it makes no sense to convert a Java object that was just allocated. If the returned value is a primitive Java type it will be converted to an integer or floating-point Tcl value. If the result is a String object, then the Java string object is converted into a Tcl string. For all other object types, a Java object handle is created and returned. If the -noconvert option is specified a Java object handle is always returned.

Tcl values are also be converted to Java objects and primitive Java types when they are given as arguments to Java commands. The default conversion for all Tcl values is a java.lang.String object. To override this default a full signature must be provided for Java method invocations.

Copyright © 1997-1998 Sun Microsystems, Inc.