Sets an object parameter for the next function or constructor call.
Note: Parameters must exactly match the method signature and they must be in order. Use the third optional parameter to specify the formal data type of the parameter.
Java.bdh
JavaSetObject( in hObject : number, in hParam : number, in sType : string optional );
Parameter | Description |
---|---|
hObject | Valid handle to a java object or JAVA_STATIC_METHOD. |
hParam | The object handle to be set as parameter. |
sType |
(Optional) The object will be treated as being of the type specified here for next method or constructor call. Syntax for the class signature must be package/subpackage/classname. Example: java/lang/String |
dcltrans transaction TInit begin // Load and start the JVM. JavaCreateJavaVM(); end TInit; transaction TPureBdl var hJTable : number; hJKeyStr : number; hJValueStr : number; hJRetVal : number; sBuffer : string; begin // prepare the key/value pair // String jKeyStr = "hello"; // String jValueStr = "world"; hJKeyStr := JavaLoadString("hello"); hJValueStr := JavaLoadString("world"); // instantiate a Hashtable // Hashtable jTable = new Hashtable(); hJTable := JavaLoadObject("java/util/Hashtable"); // insert an Object into the Hashtable // jTable.put(jKeyStr, jValueStr); JavaCastObject(hJKeyStr, "java/lang/Object"); JavaSetObject(hJTable, hJKeyStr); JavaSetObject(hJTable, hJValueStr, "java/lang/Object"); JavaCallMethod(hJTable, "put"); // retrieve an Object from the Hashtable // Object jRetVal = jTable.get(jKeyStr); JavaSetObject(hJTable, hJKeyStr); JavaCallMethod(hJTable, "get"); hJRetVal := JavaGetObject(hJTable); // retrieve print out the java string object // System.out.println("Found value \""+jRetVal+"\" in Hashtable."); JavaCallMethod(hJRetVal, "toString"); JavaGetString(hJRetVal, sBuffer); Print("Found value \""+sBuffer+"\" in Hashtable."); // Free all objects JavaFreeObject(hJTable); JavaFreeObject(hJKeyStr); JavaFreeObject(hJValueStr); JavaFreeObject(hJRetVal); end TPureBdl; transaction TEnd begin end TEnd;
JavaFrameworkBankSample.bdf
BankSample.java, Account.java, Customer.java, PremiumCustomer.java