public class JavaScriptObject
extends com.google.gwt.core.client.JavaScriptObject
public class MyCar extends JavaScriptObject {
protected MyCar() {}
public final native int getWheelNumber() / *-{ return this.wheelnb; }-* /;
public final native String getColor() / *-{ return this.color; }-* /;
}
MyCar redcar = (MyCar) MyCar.fromJson("{ wheelnb: 4, color: 'red' }");
redcar.getWheelNumber();
redcar.getColor();
JavaScriptObject| Modifier | Constructor and Description |
|---|---|
protected |
JavaScriptObject()
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
static JavaScriptObject |
fromJson(String input)
Create a JavaScriptObject from a JSON string.
|
Object |
get(String key)
Returns the reference stored in this JavaScript object for the given key.
|
com.google.gwt.core.client.JsArrayString |
getKeys()
Returns all the keys set in this JavaScript object, to use with
get(String) to iterate
over all properties, without knowing their names. |
Object |
remove(String key)
Removes a property from this JavaScript object.
|
Object |
set(String key,
Object ref)
Saves the given reference in this JavaScript object using the specified key.
|
JavaScriptType |
typeOf(String key) |
protected JavaScriptObject()
public static final JavaScriptObject fromJson(String input)
input - a valid JSON string.public final Object get(String key)
key - the key whose value to returnpublic final Object set(String key, Object ref)
key - the string used for storing and retrieving the referenceref - the object whose reference will be storedpublic final Object remove(String key)
key - the name of the property to be removedpublic final com.google.gwt.core.client.JsArrayString getKeys()
get(String) to iterate
over all properties, without knowing their names.public final JavaScriptType typeOf(String key)
key - the name of a property of this JavaScript objectCopyright © 2004–2015 XWiki. All rights reserved.