Retrieves the string return value of the last call of JavaCallMethod on the specified object or class.
Java.bdh
JavaGetString( in hObject : number, out sBuffer : string, in nBufLen : number optional );
Parameter | Description |
---|---|
hObject | Valid handle to a java object or JAVA_STATIC_METHOD. |
sBuffer | String buffer that will receive the return value of the last call of JavaCallMethod. |
nBufLen | Length of the buffer (optional). |
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