Interfaces of type JavaObject

An interface of type JavaObject provides access to Java™ code. For an overview, see EGL interfaces. For syntax, see Interface part in EGL source format.

The properties of an Interface part of type JavaObject are these:
JavaName
The name of the Java class to which the interface provides access. The default is the name of the EGL interface.
PackageName
The name of the Java package in which the class resides. If the name is not specified, no package name is used and a Java compilation error is possible.
The following pre-defined EGL interfaces are available in your code when you import the EGL package com.ibm.egl.jsf:
Object
Provides access to the Java Object class. The interface is this:
  Interface Object type JavaObject
  {
    JavaName = "Object", 
    PackageName = "java.lang"
  }
    function toString() returns (String);
  End
BooleanLib
Allows you to convert values between Boolean and integer values. The interface is this:
  Interface BooleanLib type JavaObject
  {
    JavaName = "BooleanLib", 
    PackageName = "com.ibm.javart.v6"
  }
    static function booleanToInt(var Boolean)      returns (int);
    static function intToBoolean(var int)
      returns (Boolean);
  End
Two functions are available:
  • booleanToInt returns 1 or 0, depending on the Boolean value that is passed as an argument: 1 is returned for yes, 0 is returned for no.
  • intToBoolean returns the Boolean value yes or no, depending on the integer value that is passed as an argument: yes is returned for any value other than 0, no is returned for 0.
As is true of any static functions, you access those functions by referencing the Interface part rather than a variable of that part type:
  package myPkg;    

  // required import statement   
  import com.ibm.egl.jsf;

  myInt Int = BooleanLib.booleanToInt(yes);

Other pre-defined EGL interfaces let you interact with JSF controls from a pageHandler. For an overview, see JSF component tree.

Finally, the next table shows the mapping of EGL and Java data formats at run time, when data is transferred between an argument and a parameter or when data is returned to EGL from the invoked method.

Table 1. Mapping of EGL primitives to Java types, for interfaces of type JavaObject
EGL primitive type Java type
BIGINT long
BOOLEAN (as is available in interface function descriptions) boolean
CHAR char
FLOAT double
HEX byte
INT int
SMALLINT short
SMALLFLOAT float
STRING String

Related concepts
EGL interfaces
Instantiation and EGL interfaces of type JavaObject
JSF component tree

Related tasks
Creating an EGL Interface part

Related reference
Interface part in EGL source format

Feedback
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.