net.rim.device.api.script
Class ScriptableFunction

java.lang.Object
  extended by net.rim.device.api.script.Scriptable
      extended by net.rim.device.api.script.ScriptableFunction

public abstract class ScriptableFunction
extends Scriptable

A class representing a function in the script environment.

Since:
BlackBerry API 5.0.0

Field Summary
 
Fields inherited from class net.rim.device.api.script.Scriptable
UNDEFINED
 
Method Summary
 Object construct(Object thiz, Object[] args)
          Invokes the function as a constructor on a particular object with arguments.
 Object invoke(Object thiz, Object[] args)
          Invokes the function on a particular object with arguments.
 
Methods inherited from class net.rim.device.api.script.Scriptable
enumerateFields, getElement, getElementCount, getField, getParent, putElement, putField
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Method Detail

invoke

public Object invoke(Object thiz,
                     Object[] args)
              throws Exception
Invokes the function on a particular object with arguments. Implementations of this method should execute the action associated with the function, and return the value returned from the function. The default implementation returns UNDEFINED.

Parameters:
thiz - The "this" object in the context of the function execution. This may be null.
args - The arguments passed to the function. A null value is allowed and is equivalent to a zero-length array.
Returns:
The value returned from the function. This may be null.
Throws:
Exception - any exceptions that occur during the execution of the function. These will be mapped to exceptions in the script environment where possible.
Since:
BlackBerry API 5.0.0

construct

public Object construct(Object thiz,
                        Object[] args)
                 throws Exception
Invokes the function as a constructor on a particular object with arguments. Implementations of this method should construct an object and return it, if this ScriptableFunction represents a constructor function. The default implementation throws an exception to indicate that it may not be called as a constructor.

Parameters:
thiz - The "this" object in the context of the constructor execution. This may be null.
args - The arguments passed to the constructor. A null value is allowed and is equivalent to a zero-length array.
Returns:
The constructed object. This may be null if scripting language supports null return values from constructors.
Throws:
Exception - if this function may not be called as a constructor, or if an error occurred during construction. This will be mapped to exceptions in the script environment where possible.
Since:
BlackBerry API 5.0.0





Copyright 1999-2010 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.