[prev] [up] [next]

ST/X - Java integration

Contents

Introduction

Calling static java functions from smalltalk

Use #perform: passing the java-selector, to invoke a specific static function. Example:
    JAVA::java::lang::Math perform:#'abs(I)I' with:-1234
    JAVA::java::lang::Math perform:#'abs(F)F' with:-1234.0
Use #perform: passing a smalltalk-like selector, to let ST/X choose the best matching java function:
    JAVA::java::lang::Math perform:#'abs' with:-1234
    JAVA::java::lang::Math perform:#'abs' with:-1234.0
The later are equivalent to:
    JAVA::java::lang::Math abs:-1234
    JAVA::java::lang::Math abs:-1234.0
Be aware, that this automatic choice may not lead to a definite function being invoked; for example, Math provides both float- and double-argument versions of the abs function. Or there might be versions for both the integer and the Number type.
If you are uncertain, which function is invoked (and it makes a difference), use the specific calling mechanism described first.

Some erronous examples:

    JAVA::ArcTest main
leads to an argument count mismatch error.

Some good examples:

    JAVA::ArcTest main:#()
    JAVA::ArcTest main:#('hello' 'world')


Copyright © 1998 Claus Gittinger Development & Consulting, all rights reserved

<cg@exept.de>

Doc $Revision: 1.1 $ $Date: 1999/11/25 09:20:05 $