I am using instanceof, but currently it does not work as I expect. I have a variable that I am extracting from my java code inside my script. Let me call this variable myObject, which is an instance of the MyObject class, as you would expect.
if (myObject instanceof Java.type("MyObject")) { //The check doesn't pass; the code here doesn't execute }
I could only find vague information about this. What is the specific way to check if myObject is an instance of the MyObject class, as I would easily do in Java?
Thank!
What should work for you (of course, with full class names). For instance. this definitely works:
jjs> var x = new java.util.BitSet() jjs> x instanceof Java.type("java.util.BitSet") true
: java.util.BitSet Java.type("java.util.BitSet") , , , , , .
java.util.BitSet
Java.type("java.util.BitSet")
Source: https://habr.com/ru/post/1545493/More articles:to stop testing from launching mocha - node.jsgetIntent () in onResume () always returns the same action, how to use it? - androidView Controller does not load view storyboard - iosWindows Application Database: "Unhandled exception of type" System.ArgumentException "occurred in System.Data.dll" - c #Saving javafx.scene.canvas with transparent pixels - javaSampler with Delphi XE2 - delphiAmazing results of a simple operation - javascriptfail2ban: how unban ip (using fail2ban-client) - linuxCheck valid domain - stringExpress not working - node.jsAll Articles