Description Usage Arguments Details Value Author(s) References See Also
These functions are not intended for the end user. They are used to match objects being translated between R and Java to functions that perform the conversion. They are useful for understanding the overall conversion process, and as examples for writing custom conversions.
x |
Either a reference to the Java object to be converted (e.g. |
... |
Additional arguments passed to SJava |
thisClassName |
Character representation of the class of the Java object that |
The cvt* functions take an instance of an object of one
language (R or Java) and convert it to an instance of the other
language.
The match* functions take an instance of an object, and return
a logical indicating whether the match criterion is satisified.
The convention used in RWebServices is to name the functions as
<RObject>ToJava or <RObject>FromJava.
RWebServices installs one of two types of converters. The
the function regAddonCvt installs converters for the
‘robject’ model, where R objects are represented in a hierarchy
of Java objects that attempt to capture important attributes of the R
instances. The mapping is as follows:
| R | Java |
| raw | RRaw |
| logical | RLogical |
| character | RChar |
| integer | RInteger |
| numeric | RNumeric |
| complex | RComplex |
| list | RList |
| factor | RFactor |
| data.frame | RDataFrame |
| environment | REnvironment |
| array | RArray |
| matrix | RMatrix |
| ‘other’ | RUnknown |
The ‘other’ converter is invoked when no other converter
matches. cvtUnknownToJava creates an instance of the Java class
rservices.RUnknown to hold the class, length, and
string representation (i.e., the result of print) of the contents
of the R object. cvtUnknownFromJava converts
rservices.RUnknown instance to a R S4 instance if the original
R object is a S4 instance, otherwise the function returns a list with the
same class and length as the original R object. This is
likely to be very unsatisfactory.
The function regAddonCvt2 installs converters for the
‘javalib’ model, where R objects are represented by Java
primitive types where possible; NA values are not
permitted. The mapping is as follows:
| R | Java |
| raw | byte[] |
| logical | boolean[] |
| character | String[] |
| integer | int[] |
| numeric | double[] |
| complex | RJComplex |
| list | Object[] |
| factor | RJFactor |
| data.frame | RJDataFrame |
| environment | java.util.HashMap |
| ‘*’Array, | RJ‘*’Array |
| ‘*’Matrix, | RJ‘*’Matrix |
| FileReferences | RJFileReferences |
The ‘*’Array and ‘*’Matrix and array entries represent
instances of the ArrayAndMatrix-class, which provide
strong type information about the typeof elements (raw,
logical, character, integer, numeric, complex) in arrays and
matricies.
The cvt*ToJava functions return references to Java objects. The
cvt*FromJava functions return instances of R
objects. match* return TRUE when the match criterion is
satisfied, FALSE otherwise.
Nianhua Li
http://www.omegahat.org/RSJava/index.html
setJavaFunctionConverter,
regAddonCvt,
regAddonCvt2
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.