rJava (version 0.4-16)

jfiled: Obtains the value of a field

Description

.jfield returns the value of the specified field on an object.

Usage

.jfield(o, name, simplify=TRUE, true.class=TRUE)

Arguments

o
Class name or object (Java reference) whose field is to be accessed. Static fields are supported both by specifying the class name or using an instance.
name
name of the field to access
simplify
field accessor methods always return Java objects. If set to TRUE, such object will be converted to scalar type if possible (see .jsimplify).
true.class
field accessor methods always return objects of the class java.lang.Object. If set to TRUE, the true Java class is determined and the returned object's class will be adjusted.

Value

  • Contents of the field.

Details

.jfield uses reflection to access value of a field of a given object.

See Also

.jnew, .jsimplify

Examples

Run this code
z <- .jnew("java/lang/Boolean", TRUE)
.jfield(z, "TYPE")

Run the code above in your browser using DataCamp Workspace