Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

jnull

Java null object reference


Description

.jnull returns a null reference of a specified class type. The resulting object is of the class jobjRef.

is.jnull is an extension of is.null that also returns TRUE if the supplied object is a null Java reference.

Usage

.jnull(class = "java/lang/Object")
is.jnull(x)

Arguments

class

fully qualified target class name in JNI notation (e.g. "java/lang/String").

x

object to check

Details

.jnull is necessary if null is to be passed as an argument of .jcall or .jnew, in order to be able to find the correct method/constructor.

Example: given the following method definitions of the class A:

  • opublic static void run(String a);

  • opublic static void run(Double n);

Calling .jcall("A",,"run",NULL) is ambiguous, because it is unclear which method is to be used. Therefore rJava requires class information with each argument to .jcall. If we wanted to run the String-version, we could use .jcall("A",,"run",.jnull("java/lang/String")).

is.jnull is a test that should be used to determine whether a given Java reference is a null reference.

Value

.jnull returns a Java object reference (jobjRef) of a null object having the specified object class.

is.jnull returns TRUE if is.null(x) is TRUE or if x is a Java null reference.

See Also

Examples

## Not run: 
.jcall("java/lang/System","I","identityHashCode",.jnull())

## End(Not run)

rJava

Low-Level R to Java Interface

v1.0-4
LGPL-2.1
Authors
Simon Urbanek <simon.urbanek@r-project.org>
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.