javaIs {Java}R Documentation

Performs class comparisons for Java objects

Description

Allows one to test if a Java object (in Omegahat) is an object of a particular class, or implements a particular Java interface.

Usage

javaIs(obj, klass, instanceof=T)

Arguments

obj the Java object whose class is being queried and compared
klass the name of a Java class or the Class reference object with which the object obj is being compared.
instanceof a logical value indicating whether the comparison should be done using the equality of classes or the Java instanceof semantics. The former tests whether the class of obj is the same as the class identified by klass. The latter identifies whether obj implements the Java interface class klass. (There is also the textit{assignable from} semantics which may or may not be currently present.)

Details

This calls the Omegahat evaluator's is method.

Value

a logical value indicating whether the class of obj is related to klass in the specified comparison. This is TRUE or FALSE.

Author(s)

Duncan Temple Lang, John Chambers

References

http://www.omegahat.org/RSJava

See Also

.JNew .Java

Examples

  x <- .JNew("java.util.Vector")

    # TRUE
  javaIs(x, "java.util.Vector")
  javaIs(x, "java.util.List", T)

   # FALSE
  javaIs(x, "java.util.Hashtable")