Java nashorn compare if a java objects is of a certain java type -
i using instanceof not working expect it. have variable retrieve java code within script. let's phone call variable myobject instance of myobject class, expect.
if (myobject instanceof java.type("myobject")) { //the check doesn't pass; code here doesn't execute } i find vague info on net this. definite way of checking if myobject instance of myobject class in java?
thanks!
what have should work, (with qualified class names, of course). e.g. works:
jjs> var x = new java.util.bitset() jjs> x instanceof java.type("java.util.bitset") true note: java.util.bitset , java.type("java.util.bitset") interchangeable, used both illustrate no matter how build object, result should same.
java nashorn
No comments:
Post a Comment