com.google.gwt.core.client
Class JavaScriptObject

java.lang.Object
  extended by com.google.gwt.core.client.JavaScriptObject
Direct Known Subclasses:
Element, Event

public class JavaScriptObject
extends java.lang.Object

An opaque handle to a native JavaScript object. A JavaScriptObject cannot be created directly. JavaScriptObject should be declared as the return type of a JSNI method that returns native (non-Java) objects. A JavaScriptObject passed back into JSNI from Java becomes the original object, and can be accessed in JavaScript as expected.

SUBCLASSING IS NOT SUPPORTED EXCEPT FOR THE EXISTING SUBCLASSES.


Field Summary
protected  java.lang.Object hostedModeReference
          The underlying JavaScript object.
 
Constructor Summary
protected JavaScriptObject()
          Not directly instantiable.
 
Method Summary
static JavaScriptObject createArray()
          Returns a new array.
static JavaScriptObject createFunction()
          Returns an empty function.
static JavaScriptObject createObject()
          Returns a new object.
 boolean equals(java.lang.Object other)
           
 int hashCode()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

hostedModeReference

protected java.lang.Object hostedModeReference
The underlying JavaScript object. This is used internally and should never be accessed by client code.

Constructor Detail

JavaScriptObject

protected JavaScriptObject()
Not directly instantiable. Subclasses should also define a protected no-arg constructor to prevent client code from directly instantiating the class.

Method Detail

createArray

public static JavaScriptObject createArray()
Returns a new array.


createFunction

public static JavaScriptObject createFunction()
Returns an empty function.


createObject

public static JavaScriptObject createObject()
Returns a new object.


equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object