Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.caucho.es
Class ScriptClosure

    java.lang.Object
      |
      +--com.caucho.es.ScriptClosure

public final class ScriptClosure
extends java.lang.Object

ScriptClosure lets Java programs call JavaScript functions. It contains the state of an executing JavaScript program.

Method Summary
`java.lang.Object` | `call(java.lang.String name)` Calls the JavaScript function 'name' with no arguments.
`java.lang.Object` | `call(java.lang.String name, java.lang.Object a)` Calls the JavaScript function 'name' with a single argument.
`java.lang.Object` | `call(java.lang.String name, java.lang.Object[] args)` Calls the JavaScript function 'name' with an array of arguments.
`java.lang.Object` | `call(java.lang.String name, java.lang.Object a, java.lang.Object b)` Calls the JavaScript function 'name' with two arguments.
`java.lang.Object` | `call(java.lang.String name, java.lang.Object a, java.lang.Object b, java.lang.Object c)` Calls the JavaScript function 'name' with three arguments.
`java.lang.Object` | `call(java.lang.String name, java.lang.Object a, java.lang.Object b, java.lang.Object c, java.lang.Object d)` Calls the JavaScript function 'name' with four arguments.
`long` | `getLastModified()` Returns the lastModified time of the script.
`java.lang.Object` | `getProperty(java.lang.String name)` Returns a global property of the closure.
`void` | `setProperty(java.lang.String name, java.lang.Object value)` Sets a global property of the closure.

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

Method Detail

### getLastModified

    public long getLastModified()

  Returns the lastModified time of the script. The last modified time is the maximum of all imported script modified times.

  getLastModified is vital for dynamic applications like JSP which need to reload the script when it changes.

### call

    public java.lang.Object call(java.lang.String name)
                          throws java.lang.Exception

  Calls the JavaScript function 'name' with no arguments.
  Parameters:
    `name` - JavaScript function name.
  Returns:
    The Java object returned by the JavaScript function.

### call

    public java.lang.Object call(java.lang.String name,
                                 java.lang.Object a)
                          throws java.lang.Exception

  Calls the JavaScript function 'name' with a single argument.

  Arguments are automatically wrapped, and return values automatically unwrapped.

  Parameters:
    `name` - JavaScript function name.
    `a` - First argument passed to JavaScript.
  Returns:
    The Java object returned by the JavaScript function.

### call

    public java.lang.Object call(java.lang.String name,
                                 java.lang.Object a,
                                 java.lang.Object b)
                          throws java.lang.Exception

  Calls the JavaScript function 'name' with two arguments.

  Arguments are automatically wrapped, and return values automatically unwrapped.

  Parameters:
    `name` - JavaScript function name.
    `a` - First argument passed to JavaScript.
    `b` - Second argument passed to JavaScript.
  Returns:
    The Java object returned by the JavaScript function.

### call

    public java.lang.Object call(java.lang.String name,
                                 java.lang.Object a,
                                 java.lang.Object b,
                                 java.lang.Object c)
                          throws java.lang.Exception

  Calls the JavaScript function 'name' with three arguments.

  Arguments are automatically wrapped, and return values automatically unwrapped.

  Parameters:
    `name` - JavaScript function name.
    `a` - First argument passed to JavaScript.
    `b` - Second argument passed to JavaScript.
    `c` - Third argument passed to JavaScript.
  Returns:
    The Java object returned by the JavaScript function.

### call

    public java.lang.Object call(java.lang.String name,
                                 java.lang.Object a,
                                 java.lang.Object b,
                                 java.lang.Object c,
                                 java.lang.Object d)
                          throws java.lang.Exception

  Calls the JavaScript function 'name' with four arguments.

  Arguments are automatically wrapped, and return values automatically unwrapped.

  Parameters:
    `name` - JavaScript function name.
    `a` - First argument passed to JavaScript.
    `b` - Second argument passed to JavaScript.
    `c` - Third argument passed to JavaScript.
    `d` - Fourth argument passed to JavaScript.
  Returns:
    The Java object returned by the JavaScript function.

### call

    public java.lang.Object call(java.lang.String name,
                                 java.lang.Object[] args)
                          throws java.lang.Exception

  Calls the JavaScript function 'name' with an array of arguments.

  Arguments are automatically wrapped, and return values automatically unwrapped.

  Parameters:
    `name` - JavaScript function name.
    `args` - Arguments to pass to the JavaScript function.
  Returns:
    The Java object returned by the JavaScript function.

### getProperty

    public java.lang.Object getProperty(java.lang.String name)

  Returns a global property of the closure.
  Parameters:
    `name` - name of the global property
  Returns:
    unwrapped Java object of the global property.

### setProperty

    public void setProperty(java.lang.String name,
                            java.lang.Object value)

  Sets a global property of the closure.
  Parameters:
    `name` - name of the global property
    `value` - Java object to assign to the global property.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD