Description Usage Arguments Details Value Note Author(s) References See Also Examples
Calls a Java method, transferring R arguments to the Java (Omegahat)
system as needed. This can be used to call methods in the Omegahat
evaluator, not just on previously created user-level objects. One
must create and initialize the Java virtual machine before calling
this function. See .JavaInit
.
1 |
.qualifier |
The Java object whose method is to be invoked.
This is the ‘this’ in the Java call and is typically a reference
obtained as the result of a previous call to |
.methodName |
The name of the method (or function if
|
... |
arguments to be passed to the Java method call. Any values that are named (i.e. x = 1) are assigned persistently to the Omegahat named reference database and can be referenced directly in future calls. |
.name |
The name to use to store the result in the omegahat named
reference database. If this is missing, an anonymous reference is
returned or the value converted to an R object. If the result of the
Java method can be converted, this argument can be used to prohibit
this conversion and leave the Java value in Omegahat for use in
future |
.sigs |
A character vector of class identifiers that help to
identify the Java method to be invoked. This is used to avoid
ambiguity introduced by Java's polymorphism/overloaded names and the
automatic/implicit conversion performed between R and Java objects.
This should have an entry for each argument passed via ... and
governs how we convert that S value to a Java value. See
|
.convert |
typically a logical value that indicates whether the
Omegahat manager should attempt to convert the result of the method
call. This is usually Also, one can specify a native routine (i.e. C/C++/Fortran)
address. This can be done using
|
This invokes a Java method on the target object by first converting the R arguments to Java objects and then searching the Java object for a method that accepts these Java argument types. Then it invokes the method and converts the result to a Java object using the basic and extensible conversion mechanism between Java and R.
The return value of the Java method invocation, converted to an R
object. If the Java value is considered convertible, one of the
registered converters is called. By default, these handle primitives
(scalars) and Java collections. The user can register others. If no
converter is found, a reference to the Java object is returned as an R
object. If the .name
argument was supplied in the call to this
R function, the reference is a NamedReference
. Otherwise, it is
a AnonymousReference
.
Uses the Omegahat interactive Java environment.
Duncan Temple Lang, John Chambers
http://www.omegahat.org/RSJava
.JavaConstructor
.OmegahatExpression
getJavaConverterDescriptions
foreignReference
1 2 3 4 5 6 7 8 9 10 | v <- .JavaConstructor("java.util.Vector", as.integer(10))
.Java(v, "add", "A string element")
.Java(v, "add", .JavaConstructor("java.util.Hashtable", as.integer(3)))
.Java(v, "size")
props <- .Java("System", "getProperties")
props[["java.class.path"]]
props <- .Java("System", "getProperties", .convert=FALSE)
props$getProperty("java.class.path")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.