jcast(rJava)
jcast()所属R语言包:rJava
Cast a Java object to another class
施放一个Java对象到另一个类
译者:生物统计家园网 机器人LoveR
描述----------Description----------
.jcast returns a Java object reference cast to another Java class.
.jcast返回一个Java对象转换为另一个Java类的参考。
用法----------Usage----------
.jcast(obj, new.class = "java/lang/Object", check = FALSE, convert.array = FALSE)
参数----------Arguments----------
参数:obj
a Java object reference
一个Java对象引用
参数:new.class
fully qualified class name in JNI notation (e.g. "java/lang/String").
在JNI符号类的完全限定名称(如"java/lang/String")。
参数:check
logical. If TRUE, it is checked that the object effectively is an instance of the new class. See %instanceof%. Using FALSE (the default) for this argument, rJava does not perform type check and this will cause an error on the first use if the cast is illegal.
逻辑。如果TRUE,它被选中的对象实际上是一个新的类的实例。看到%instanceof%。 rJava使用此参数FALSE(默认值),不进行类型检查,这将导致错误,如果是非法的演员第一次使用。
参数:convert.array
logical. If TRUE and the object is an array, it is converted into a jarrayRef reference.
逻辑。如果TRUE的对象是一个数组,它转换成一个jarrayRef参考。
Details
详情----------Details----------
This function is necessary if a argument of .jcall or .jnew is defined as the superclass of the object to be passed (see .jcall). The original object is not modified.
此功能是必要的,如果.jcall或.jnew是要传递的对象的超类定义的参数(见.jcall)。原来的对象没有被修改。
The default values for the arguments check and convert.array is FALSE in order to guarantee backwards compatibility, but it is recommended to set the arguments to TRUE
默认值参数check和convert.array是FALSE为了保证向后兼容性,但它建议设置参数TRUE
值----------Value----------
Returns a Java object reference (jobjRef) to the object obj, changing the object class.
返回一个Java对象引用(jobjRef)的对象obj,改变对象的类。
参见----------See Also----------
.jcall
.jcall
举例----------Examples----------
## Not run: [#无法运行:]
v <- .jnew("java/util/Vector")
.jcall("java/lang/System","I","identityHashCode",.jcast(v, "java/lang/Object"))
## End(Not run)[#结束(不运行)]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|