org.helma.javascript
Class Prototype

java.lang.Object
  extended byorg.helma.javascript.Prototype

public class Prototype
extends java.lang.Object

This class represents a prototype created from a JavaScript file. The script file is evaluated against the prototype object so all functions defined therein become properties of the prototype.

Author:
Hannes Wallnoefer

Constructor Summary
Prototype(java.io.File file)
          Construct a Prototype from the given script file.
 
Method Summary
 org.mozilla.javascript.Scriptable getScriptedObject(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable scope)
          Get the actual prototype object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Prototype

public Prototype(java.io.File file)
Construct a Prototype from the given script file.

Parameters:
file - the JavaScript file to be applied to this prototype.
Method Detail

getScriptedObject

public org.mozilla.javascript.Scriptable getScriptedObject(org.mozilla.javascript.Context cx,
                                                           org.mozilla.javascript.Scriptable scope)
                                                    throws org.mozilla.javascript.JavaScriptException,
                                                           java.io.IOException
Get the actual prototype object. This evaluates the script file if necessary.

Parameters:
cx - the current Context
scope - the global scope
Returns:
the prototype object
Throws:
org.mozilla.javascript.JavaScriptException - if an error occurred evaluating the prototype script code
java.io.IOException - if an error occurred reading the script file