.JavaRef
Access Java Object References

Description

fucntions to create, test, and manipulate Java object references.

Usage

.JavaRef(object=NULL, javaClass=NULL)
.JavaRefIsArray(object)
.JavaRefIsNull(object)
.JavaRefIsPrimitive(object)
.JavaRefIsRef(object)
.JavaRefIsValid(object)
.JavaSimplify(object)

Arguments

object any object, including a Java object reference.
javaClass a string specifying a full Java classname, such as "Ljava/lang/Math;". This class can also be specified as "java/lang/Math" or "java.lang.Math".

Details

.JavaRef is the simplest way to convert regular data objects such as integer vectors to Java objects references, and .JavaSimplify is the way to convert them back.
If .JavaRef is called with javaClass equal to NULL, the class is determined by calling .JavaClass.
Value
.JavaRefreturns a Java object reference to the new Java object created with the specified class. If object is already a Java object reference, it is just returned.
.JavaRefIsArrayreturns TRUE if object is a Java object reference to a Java array.
.JavaRefIsNullreturns TRUE if object is a Java object reference to the null Java object.
.JavaRefIsArrayreturns TRUE is object is a Java object reference to a Java array.
.JavaRefIsPrimitivereturns TRUE if object is a Java object reference to a primitive Java value, such as a scalar integer or double.
.JavaRefIsRefreturns TRUE if object is a Java object reference.
.JavaRefIsValidreturns TRUE if object is a valid Java object reference. A Java object reference object becomes invalid when it is serialized and deserialized.
.JavaSimplifyreturns a Java object reference converted to a simpler object, such as a Java double array converted to a double vector. If object is not a Java object reference, it is just returned. If object is a Java object reference that cannot be converted, it is just returned.
See Also
.JavaCall, .JavaFieldGet, .JavaClass, .JavaArray
Examples
## create a Java reference to an integer array
xx <- .JavaRef(1:3)

.JavaRefIsArray(xx) ## TRUE .JavaRefIsNull(xx) ## FALSE .JavaRefIsPrimitive(xx) ## FALSE .JavaRefIsRef(xx) ## TRUE .JavaRefIsValid(xx) ## TRUE

.JavaSimplify(xx) ## [1] 1 2 3

## make references to the Java null object .JavaRef(NULL, "java.lang.Object") .JavaRef(NULL, "java.lang.String")

Package terrJava version 6.0.0-69
Package Index