JavaSetFloat Function

Action

Sets a float parameter for the next function or constructor call.

Note: Parameters must exactly match the method signature and be in order. Use the third optional parameter to distinguish between the different float data types of the Java language.

Include file

Java.bdh

Syntax

JavaSetFloat( in hObject: number,
              in fParam : float,
              in sType  : string optional );
Parameter Description
hObject Valid handle to a java object or JAVA_STATIC_METHOD.
fParam The float value to be set as parameter.
sType

(optional)

Can be:

  • JAVA_FLOAT (default)

  • JAVA_DOUBLE

Example

var
  hTestObj   : number; 

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

    // instantiate the java class
    hTestObj := JavaLoadObject("Test");
  end TInit;

  transaction TMyJavaTrans
  var
    fValue : float;
  begin                                
    ThinkTime(0.2);
    // set the first parameter
    JavaSetString(hTestObj, "1");
    // set the second parameter
    JavaSetFloat(hTestObj, 1.1, JAVA_FLOAT);
    // invoke the method
    JavaCallMethod(hTestObj, "doFoo");
    // retrieve the result
    fValue := JavaGetFloat(hTestObj);
    Print("doFoo returned "+String(fValue));
  end TMyJavaTrans;

  transaction TEnd
  begin
    JavaFreeObject(hTestObj);
  end TEnd;

Sample scripts

JavaFrameworkBankSample.bdf

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