Generating proxies for Java
classes
You need to develop PowerBuilder proxies for the Java classes you
want to invoke from PowerBuilder. You can develop proxies using Java
reflection, from Java source code directly, or using the javap tool. For
example, suppose you want to invoke this Java class:
|
1 2 3 4 5 |
public class Converter { public double dollarToYen(double dollar); public double yenToEuro(double yen); } |
The PowerBuilder proxy for this Java class could be stored in a file
called converter.srx that looks like this:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
$PBExportHeader$converter.srx $PBExportComments$Proxy generated for Java class global type Converter from nonvisualobject end type global Converter Converter forward prototypes public: function double dollarToYen(double ad_1) alias for "dollarToYen,(D)D" function double yenToEuro(double ad_1) alias for "yenToEuro,(D)D" end prototypes |
Notice that both PowerBuilder proxy methods have an alias containing
the Java method name and method signature. This is necessary because Java
is case sensitive, but PowerBuilder is not. The extension uses the alias
information is used by the extension to find the corresponding Java
methods.
To add the proxy to a PowerScript target, select the library where
the proxy will be stored in the System Tree, select Import from the pop-up
menu, and browse to select converter.srx.