Functions - java

createNull

Returns a handle that refers to Java null.

fromString

Returns a handle that refers to the Java string representation of the Ballerina string.

getClass

Returns a handle that refers to the Java Class object associated with the class or interface with the given string name.

This function performs a Java class.forName(name) except for following cases:

name output boolean the Java Class instance representing the Java primitive type boolean byte the Java Class instance representing the Java primitive type byte char the Java Class instance representing the Java primitive type char short the Java Class instance representing the Java primitive type short int the Java Class instance representing the Java primitive type int long the Java Class instance representing the Java primitive type long float the Java Class instance representing the Java primitive type float double the Java Class instance representing the Java primitive type double

isNull

Returns true if this handle refers to Java null.

toString

Returns a Ballerina string representation of the Java object referred by the handle.

If the handle refers to Java null, then this function returns a nil value.

createNull

()

returns handle

Returns a handle that refers to Java null.

  • Return Type

    (handle)
  • the handle that refers to Java null

fromString

(string value)

returns handle

Returns a handle that refers to the Java string representation of the Ballerina string.

Parameters

  • value string
  • the Ballerina string with which the handle is created

  • Return Type

    (handle)
  • the handle that refers to the Java String representation of the Ballerina string

getClass

(string name)

returns handle | error

Returns a handle that refers to the Java Class object associated with the class or interface with the given string name.

This function performs a Java class.forName(name) except for following cases:

name output boolean the Java Class instance representing the Java primitive type boolean byte the Java Class instance representing the Java primitive type byte char the Java Class instance representing the Java primitive type char short the Java Class instance representing the Java primitive type short int the Java Class instance representing the Java primitive type int long the Java Class instance representing the Java primitive type long float the Java Class instance representing the Java primitive type float double the Java Class instance representing the Java primitive type double

Parameters

  • name string
  • the name of the Java class

  • Return Type

    (handle | error)
  • the Java Class object for the class with the given name.

isNull

(handle value)

returns boolean

Returns true if this handle refers to Java null.

Parameters

  • value handle
  • the handle whose referred value to be tested with Java null

  • Return Type

    (boolean)
  • true if this handle refers to Java null

toString

(handle value)

returns string

Returns a Ballerina string representation of the Java object referred by the handle.

If the handle refers to Java null, then this function returns a nil value.

Parameters

  • value handle
  • the handle whose referred value to be converted to Ballerina string

  • Return Type

    (string)
  • the Ballerina string representation of the Java object referred by the handle or returns nil of the handle refers to Java null