|
JNIPort for Dolphin Smalltalk |
|
Back to Goodies |
Additional Pre-defined Wrapper ClassesJNIPort comes with a package of extra pre-defined wrapper classes. These are provided:
The additional wrappers are not needed by JNIPort proper, although they are used by some of the examples. Nearly all of them wrap common Java classes, the Java 2 Collections, the Java IO classes, and the Java iterators, and give them something of the protocol of the Smalltalk equivalents. There are a few other wrapper classes in the package, but none of them add much, if anything, to what the Wrapper Wizard generated. Just as a warning: these wrapper classes are not, in general, as lavishly commented as is my habit. You are expected to know the Smalltalk interface to the various Collection classes, for example, and if you are looking at the implementation of the adaptors then you are also expected to know about the equivalent Java classes. For similar reasons, this section is very short. IO-Stream Wrappers
There are two classes,
These classes illustrate an important point — it is not necessary to follow the Java
class hierarchy slavishly when designing the hierarchy of wrapper classes. In this case, for
instance, Collection Wrappers
Java's new (well, it is fairly old now) Collections API is defined by a handful of
interfaces: For that reason, the Java Collections are a good example of the need for interface instances, JNIPort's built-in facility for associating an adaptor with a Java interface. (In point of fact, they were the motivation for it.)
Given a Java object that implements the Iterator Wrappers
Java has two external iterator classes; the old |
Copyright © Chris Uppal, 2003-2005
Java, JNI (probably), JVM (possibly), and God knows what else, are trademarks of Sun Microsystems, Inc.