public class JavaScriptObjectX extends JavaScriptObject
Modifier | Constructor and Description |
---|---|
protected |
JavaScriptObjectX() |
Modifier and Type | Method and Description |
---|---|
JsArrayString |
_enumerablePropertyNames()
Returns the names of all enumerable properties of this object, including any
inherited ones.
|
Iterable<String> |
_in()
Constructs an iterable over the enumerable property names of this object.
|
static boolean |
_isDuckType(JavaScriptObject js,
String... ownPropertyNames)
Answers whether the specified object looks like an instance of a particular
JavaScriptObject subclass defined by the names of its non-inherited, own properties.
|
static boolean |
_isDuckType(Object o,
String... ownPropertyNames)
Answers whether the specified object looks like an instance of a particular
JavaScriptObject subclass defined by the names of its non-inherited, own properties.
|
_delete, _get, _getBoolean, _getByte, _getChar, _getDouble, _getFloat, _getInt, _getShort, _getString, _hasOwnProperty, _hasProperty, _propertyIsEnumerable, _set, _setBoolean, _setByte, _setChar, _setDouble, _setFloat, _setInt, _setShort, _setString, cast, createArray, createArray, createFunction, createObject, equals, hashCode, toSource, toString
protected JavaScriptObjectX()
public final JsArrayString _enumerablePropertyNames()
public static boolean _isDuckType(JavaScriptObject js, String... ownPropertyNames)
public static boolean _isDuckType(Object o, String... ownPropertyNames)
public final Iterable<String> _in()
for/in
syntax:for( var name in o ) window.alert( name ); // JavaScript
The ideal equivalent in Java would probably be a foreach
loop over
an iterable JavaScriptObject (jso), similar to this:
for( String name: jso ) Window.alert( name ); // not possible
But that is not possible because a GWT bug prevents JavaScriptObject from implementing Iterable. Hence this method, which allows for iteration over a JavaScriptObjectX (jsox) like this:
for( String name: jsox._in() ) Window.alert( name );