JavaGetBoolean Function

Action

Retrieves the boolean return value of the last call of JavaCallMethod on the specified object or class.

Include file

Java.bdh

Syntax

JavaGetBoolean( in hObject: number ): boolean;

Return value

  • Returns the result of the last call of JavaCallMethod.

Parameter Description
hObject Valid handle to a java object or JAVA_STATIC_METHOD.

Example

var
  hTestObj   : number; 

dcltrans
  transaction TInit
  begin
      // Load and start the JVM.
      JavaCreateJavaVM();

      // instantiate the java class
      hTestObj := JavaLoadObject("Test");
  end TInit;
 
  transaction TPureBdl
  var hJTable    : number;
      hJKeyStr   : number;
      hJValueStr : number;
      hJRetVal   : number;
      sBuffer    : string;
      bHasNext   : boolean;
  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);

    JavaCallMethod(hJRetVal, "hasNext");
    bHasNext := JavaGetBoolean(hJRetVal);

    // Free all objects
    JavaFreeObject(hJTable);
    JavaFreeObject(hJKeyStr);
    JavaFreeObject(hJValueStr);
    JavaFreeObject(hJRetVal);
  end TPureBdl;

  transaction TEnd
  begin
    JavaFreeObject(hTestObj);
  end TEnd;

Sample scripts

JavaFrameworkBankSample.bdf

BankSample.java, Account.java, Customer.java, PremiumCustomer.java