JavaGetNumber Function

Action

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

Include file

Java.bdh

Syntax

JavaGetNumber( in hObject: number ): number;

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 TStaticMethods
  var
    str    : string;
    nConv1 : number;
    nConv2 : number;
    hJStr  : number;
  begin 
    str := "123";
   
    nConv1 := Number(str);

    JavaSetString(JAVA_STATIC_METHOD, str);
    JavaCallMethod(JAVA_STATIC_METHOD, "java/lang/Integer.parseInt");
    nConv2 := JavaGetNumber(JAVA_STATIC_METHOD);

    if nConv1 = nConv2 then
      Print("Both conversion delievered the same result! ("+String(nConv1)+" = "+String(nConv2)+")");
    end;
  end TStaticMethods;

  transaction TEnd
  begin
    JavaFreeObject(hTestObj);
  end TEnd;

Sample scripts

JavaFrameworkBankSample.bdf

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