org.directwebremoting.extend
Class DefaultJavascriptObject

java.lang.Object
  extended by org.directwebremoting.extend.DefaultJavascriptObject
All Implemented Interfaces:
java.lang.reflect.InvocationHandler, JavascriptObject

public class DefaultJavascriptObject
extends java.lang.Object
implements JavascriptObject, java.lang.reflect.InvocationHandler

Represents a callback function, passed in from a client for later execution.

A DefaultJavascriptFunction is tied to a specific function in a specific browser page. In this way the eval of a DefaultJavascriptFunction is outside of the normal execution scoping provided by Browser.

Author:
Joe Walker [joe at getahead dot ltd dot uk]

Constructor Summary
DefaultJavascriptObject(ScriptSession session, java.lang.String id)
           
 
Method Summary
 void close()
          A small amount of data is stored on the client to track the remotely.
 boolean equals(java.lang.Object obj)
           
 void execute(java.lang.String methodName, java.lang.Object... params)
          Execute the function.
 int hashCode()
           
 java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)
           
 void set(java.lang.String propertyName, java.lang.Object data)
          Add a property to a JavaScript object.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultJavascriptObject

public DefaultJavascriptObject(ScriptSession session,
                               java.lang.String id)
Method Detail

invoke

public java.lang.Object invoke(java.lang.Object proxy,
                               java.lang.reflect.Method method,
                               java.lang.Object[] args)
                        throws java.lang.Throwable
Specified by:
invoke in interface java.lang.reflect.InvocationHandler
Throws:
java.lang.Throwable

execute

public void execute(java.lang.String methodName,
                    java.lang.Object... params)
Description copied from interface: JavascriptObject
Execute the function. TODO: At some stage it would be good to allow the final parameter to be a Callback....

Specified by:
execute in interface JavascriptObject
params - The data to pass to the server

set

public void set(java.lang.String propertyName,
                java.lang.Object data)
Add a property to a JavaScript object. The type of the data must be convertible by DWR.

Specified by:
set in interface JavascriptObject

close

public void close()
Description copied from interface: JavascriptObject
A small amount of data is stored on the client to track the remotely. accessible objects. To clear this data, the function needs to be cleared on the server.

Specified by:
close in interface JavascriptObject

toString

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

equals

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

hashCode

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

Copyright 2008