Retrieves a handle on the object returned by the last call of JavaCallMethod on the specified object or class. The object retrieved may be reused for further calls of or JavaSetObject and must be released with JavaFreeObject.
Java.bdh
JavaGetObject( in hObject : number ): number;
Returns a handle on the result of the last call of JavaCallMethod.
Parameter | Description |
---|---|
hObject | Valid handle to a java object or JAVA_STATIC_METHOD. |
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