com.plotnix.jex.javascript
Class JavaScriptExpression

java.lang.Object
  |
  +--com.plotnix.jex.javascript.JavaScriptExpression
Direct Known Subclasses:
JavaScriptIterationExpression, JavaScriptValueExpression, JavaScriptVariableExpression

public abstract class JavaScriptExpression
extends java.lang.Object

Version:
$Revision$ $Date$
Author:
Dmitri Plotnikov

Field Summary
static java.lang.String JS_AUTODECLARE
          By default, Jex does not allow assignment to undeclared variables.
static java.lang.String JS_GLOBAL_SCOPE_PROPERTY
          Jex stores the Global Scope for evaluation of JavaScript expressions in the root Jex Context as a property named JS_GLOBAL_SCOPE_PROPERTY
protected static java.lang.String JS_PSEUDO_VARIABLE
          Name of the pseudo-variable used by JavaScriptVariableExpression to hold the value to be assigned.
static java.lang.String JS_SCOPE_PROPERTY
          Jex stores the Local Scope for evaluation of JavaScript expressions in the current Jex Context as a property named JS_SCOPE_PROPERTY
 
Constructor Summary
JavaScriptExpression(org.mozilla.javascript.Script script)
           
 
Method Summary
protected  org.mozilla.javascript.Scriptable getContextScope(Context context, org.mozilla.javascript.Context jsContext)
          Creates a JavaScript scope for this JexContext.
protected  org.mozilla.javascript.Scriptable getGlobalScope(Context context, org.mozilla.javascript.Context jsContext)
          Creates a global JavaScript scope.
protected  org.mozilla.javascript.Scriptable getLocalScope(Context context, org.mozilla.javascript.Context jsContext, java.lang.Object[] arguments)
          Creates a new scope for the evaluation of an expression.
protected  org.mozilla.javascript.Scriptable getLocalScope(Context context, org.mozilla.javascript.Context jsContext, java.lang.Object[] arguments, java.lang.Object value)
          Creates a new scope for the evaluation of an expression.
 org.mozilla.javascript.Script getScript()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JS_GLOBAL_SCOPE_PROPERTY

public static final java.lang.String JS_GLOBAL_SCOPE_PROPERTY
Jex stores the Global Scope for evaluation of JavaScript expressions in the root Jex Context as a property named JS_GLOBAL_SCOPE_PROPERTY

JS_SCOPE_PROPERTY

public static final java.lang.String JS_SCOPE_PROPERTY
Jex stores the Local Scope for evaluation of JavaScript expressions in the current Jex Context as a property named JS_SCOPE_PROPERTY

JS_AUTODECLARE

public static final java.lang.String JS_AUTODECLARE
By default, Jex does not allow assignment to undeclared variables. To relax this restriction, define a property called JS_AUTODECLARE ("javascript.autodeclare") in the context that will host the new variables.

JS_PSEUDO_VARIABLE

protected static final java.lang.String JS_PSEUDO_VARIABLE
Name of the pseudo-variable used by JavaScriptVariableExpression to hold the value to be assigned.
Constructor Detail

JavaScriptExpression

public JavaScriptExpression(org.mozilla.javascript.Script script)
Parameters:
script - is a compiled JavaScript to be associated with this expression
Method Detail

getScript

public org.mozilla.javascript.Script getScript()
Returns:
the compiled JavaScript

getLocalScope

protected org.mozilla.javascript.Scriptable getLocalScope(Context context,
                                                          org.mozilla.javascript.Context jsContext,
                                                          java.lang.Object[] arguments)
Creates a new scope for the evaluation of an expression. Makes the new scope a child of the Scriptable associated with the Context.
Parameters:
context - is a Jex Context
jsContext - is a javascript context for this operation
arguments - should have the length of zero or one. The first argument of the array (or null) is used as the context bean.
Returns:
Local scope

getLocalScope

protected org.mozilla.javascript.Scriptable getLocalScope(Context context,
                                                          org.mozilla.javascript.Context jsContext,
                                                          java.lang.Object[] arguments,
                                                          java.lang.Object value)
Creates a new scope for the evaluation of an expression. Makes the new scope a child of the Scriptable associated with the Context. Declares a pseudo-variable in the new context that is used by JavaScriptVariableExpression as a holder for the value to be assigned.
Parameters:
context - is a Jex Context
jsContext - is a javascript context for this operation
arguments - should have the length of zero or one. The first argument of the array (or null) is used as the context bean.
value - is the value assigned to the pseudo-variable
Returns:
Local scope

getContextScope

protected org.mozilla.javascript.Scriptable getContextScope(Context context,
                                                            org.mozilla.javascript.Context jsContext)
Creates a JavaScript scope for this JexContext. Provides access to the context variables. Caches the JavaScript scope in the context itself.
Parameters:
context - is a Jex Context
jsContext - is a javascript context for this operation
Returns:
Context scope

getGlobalScope

protected org.mozilla.javascript.Scriptable getGlobalScope(Context context,
                                                           org.mozilla.javascript.Context jsContext)
Creates a global JavaScript scope. Caches the scope in the root Jex context.
Parameters:
context - is a Jex Context
jsContext - is a javascript context for this operation
Returns:
Global scope


Copyright (c) 2002 - Plotnix, Inc