JavaScript objects, when you access them in Java, are all essentially the same class: ScriptableObject
which implements the Scriptable
interface (GitHub source). There are a few other classes for functions and other specialized objects.
The Scriptable
interface includes methods like get
, has
, and put
that correspond roughly to myObject.string1
, myObject.hasOwnProperty("string1")
, and myObject.string1 = "Hello"
in JavaScript. The ScriptableObject
class adds some other useful methods for defining properties, etc.