jcast {rJava} | R Documentation |
.jcast
returns a Java object reference cast to another Java class.
.jcast(obj, new.class = "java/lang/Object")
obj |
a Java object reference |
new.class |
fully qualified class name in JNI notation
(e.g. "java/lang/String" ). Although rJava itself performs no
type check in .jcast , Java will produce an exception on the
first use if the cast is illegal. |
This function is necessary if a argument of .jcall
or
.jnew
is defined as the superclass of the object to be
passed (see .jcall
). No type checking is performed and
the original object is not modified.
Returns a Java object reference (jobjRef
) to the object
obj
, changing the object class.
## Not run: v <- .jnew("java/util/Vector") .jcall("java/lang/System","I","identityHashCode",.jcast(v, "java/lang/Object")) ## End(Not run)