## com.google.gwt.core.client
Class JavaScriptObject

    java.lang.Object
      com.google.gwt.core.client.JavaScriptObject

Direct Known Subclasses:
  Event, Node, NodeCollection, NodeList, Style

    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.

Constructor Summary
`protected` `JavaScriptObject()` Not directly instantiable.

Method Summary

`

`<T extends JavaScriptObject> T`

`

`cast()`
A helper method to enable cross-casting from any `JavaScriptObject` type to any other `JavaScriptObject` type.

`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)` Returns `true` if the objects are JavaScript identical (triple-equals).
`int` `hashCode()` Uses a monotonically increasing counter to assign a hash code to the underlying JavaScript object.
`java.lang.String` `toString()` Returns the results of calling `toString` in JavaScript on the object, if the object implements toString; otherwise returns "[JavaScriptObject]".

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### JavaScriptObject

    protected JavaScriptObject()

  Not directly instantiable. All subclasses must also define a protected, empty, no-arg constructor.

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.

### cast

    public final <T extends JavaScriptObject> T cast()

  A helper method to enable cross-casting from any `JavaScriptObject` type to any other `JavaScriptObject` type.

  Type Parameters:
    `T` - the target type
  Returns:
    this object as a different type

### equals

    public final boolean equals(java.lang.Object other)

  Returns `true` if the objects are JavaScript identical (triple-equals).

  Overrides:
    `equals` in class `java.lang.Object`

### hashCode

    public final int hashCode()

  Uses a monotonically increasing counter to assign a hash code to the underlying JavaScript object. Do not call this method on non-modifiable JavaScript objects. TODO: if the underlying object defines a 'hashCode' method maybe use that?

  Overrides:
    `hashCode` in class `java.lang.Object`
  Returns:
    the hash code of the object

### toString

    public final java.lang.String toString()

  Returns the results of calling `toString` in JavaScript on the object, if the object implements toString; otherwise returns "[JavaScriptObject]".

  Overrides:
    `toString` in class `java.lang.Object`