.Java(.Java( .Java(o, "getClass"), "getSuperclass"), "getName")
)
ref <- foreignReference(mtcars)
jdata <- .JavaConstructor("RDynamicDataFrame", ref)
jdata$numObservations()
In this case, the last call actually goes to Java which calls
the
method numObservations() in
RDynamicDataFrame
which calls R and gets the number of rows in the mtcars object
stored in the foreign reference manager.
This could be done with a few extensions in the following way:
obj <- getJavaHandler()$getReference(jdata$referenceName)
obj$numObservations()
isJavaInitialized().
r <- .JavaArrayConstructor("String", dim=c(2,0))
.Java(NULL,"identity", r)
yields garbage.
x <- .JavaConstructor("javax.swing.JFrame")
.Java(x,"setBounds",as.integer(10),as.integer(10),as.integer(100),as.integer(100))
.Java(x,"setVisible",T)
Second time around, it doesn't seem to work!