org.eclipse.higgins.util.jscript
Class JScriptExecHelper

java.lang.Object
  extended byorg.eclipse.higgins.util.jscript.JScriptExecHelper

public class JScriptExecHelper
extends Object

Random helper functions for dealing with Java - JavaScript conversion and storage.

Author:
dbuss@novell.com

Constructor Summary
JScriptExecHelper()
           
 
Method Summary
static String evaluateToString(JScriptExec exec, String[] paramNames, Object[] params)
          Allows String Transformation or Retrieval
static String evaluateToString(JScriptExec exec, String paramName, Object in)
          Allows String Transformation or Retrieval
static String transformString(JScriptExec exec, String paramName, String param)
          Allows String Transformation
static URI transformURI(JScriptExec exec, String[] paramNames, URI in)
          Allows URI Transformation
static URI transformURI(JScriptExec exec, String[] paramNames, URI[] in)
          Allows URI Transformation
static URI transformURI(JScriptExec exec, String paramName, URI in)
          Allows URI Transformation
static Iterator transformURItoMany(JScriptExec exec, String paramName, URI in)
          Allows URI Transformation
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JScriptExecHelper

public JScriptExecHelper()
Method Detail

transformString

public static String transformString(JScriptExec exec,
                                     String paramName,
                                     String param)
                              throws JScriptException
Allows String Transformation

Parameters:
exec - The Compiled JavaScript, If null the in param will be the return value
paramName - A string specifying the name of the JavaScript variable the input String is accessible by.
param - The original value
Returns:
a String, if more than one String is returned by the JavaScript only the first one will be returned from this routine. If for any reason the value cannot be computed, the in param will be returned.
Throws:
JScriptException

transformURI

public static URI transformURI(JScriptExec exec,
                               String[] paramNames,
                               URI in)
                        throws JScriptException
Allows URI Transformation

Parameters:
exec - The Compiled JavaScript, If null the in param will be the return value
paramNames - A string array specifying the names of the JavaScript variables the URI accessible by.
in - The original URI value
Returns:
a URI, if more than one URI is returned by the JavaScript only the first one will be returned from this routine. If for any reason the value cannot be computed, the in param will be returned.
Throws:
JScriptException

transformURI

public static URI transformURI(JScriptExec exec,
                               String[] paramNames,
                               URI[] in)
                        throws JScriptException
Allows URI Transformation

Parameters:
exec - The Compiled JavaScript, If null the in param will be the return value
paramNames - A string array specifying the names of the JavaScript variables the URI accessible by.
in - The original URI value and other data as needed
Returns:
a URI, if more than one URI is returned by the JavaScript only the first one will be returned from this routine. If for any reason the value cannot be computed, null will be returned.
Throws:
JScriptException

transformURI

public static URI transformURI(JScriptExec exec,
                               String paramName,
                               URI in)
                        throws JScriptException
Allows URI Transformation

Parameters:
exec - The Compiled JavaScript, If null the in param will be the return value
paramName - A string specifying the name of the JavaScript variable the URI will accessible by.
in - The original URI value
Returns:
a URI, if more than one URI is returned by the JavaScript only the first one will be returned from this routine. If for any reason the value cannot be computed, the in param will be returned.
Throws:
JScriptException

transformURItoMany

public static Iterator transformURItoMany(JScriptExec exec,
                                          String paramName,
                                          URI in)
                                   throws JScriptException
Allows URI Transformation

Parameters:
exec - The Compiled JavaScript, If null the in param will be the return value
paramName - A string specifying the name of the JavaScript variable the URI will accessible by.
in - The original URI value
Returns:
a Iterator, if more than one URI is returned by the JavaScript only the first one will be returned from this routine.
Throws:
JScriptException

evaluateToString

public static String evaluateToString(JScriptExec exec,
                                      String[] paramNames,
                                      Object[] params)
                               throws JScriptException
Allows String Transformation or Retrieval

Parameters:
exec - The Compiled JavaScript, If nul the in param will be the return value
paramNames - An array of strings specifying the names of the JavaScript variables
params - An object array
Returns:
a String, if more than one String is returned by the JavaScript only the first one will be returned from this routine.
Throws:
JScriptException

evaluateToString

public static String evaluateToString(JScriptExec exec,
                                      String paramName,
                                      Object in)
                               throws JScriptException
Allows String Transformation or Retrieval

Parameters:
exec - The Compiled JavaScript, If nul the in param will be the return value
paramName - A string specifying the names of the JavaScript variables
in - The original URI value
Returns:
a String, if more than one String is returned by the JavaScript only the first one will be returned from this routine.
Throws:
JScriptException