|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface ScriptEngineFactory
See Javadoc of Java Scripting API
| Method Summary | |
|---|---|
java.lang.String |
getEngineName()
Retrieves the full name of the ScriptEngine. |
java.lang.String |
getEngineVersion()
Retrieves the version of the Script Engine. |
java.util.List |
getExtensions()
Retrieves an immutable list of Strings which are file extensions typically used for files containing scripts written in the language supported by the ScriptEngine. |
java.lang.String |
getLanguageName()
Retrieves the name of the language supported by the ScriptEngine. |
java.lang.String |
getLanguageVersion()
Retrieves the version of the language supported by the ScriptEngine. |
java.lang.String |
getMethodCallSyntax(java.lang.String objectName,
java.lang.String method,
java.lang.String[] args)
Returns a String which can be used to invoke a method of a Java object using the syntax of the supported scripting language. |
java.util.List |
getMimeTypes()
Retrieves an immutable list of Strings containing MIME types describing the content which can be processed using the Script Engine. |
java.util.List |
getNames()
Retrieves an immutable list of short descriptive names such as {"javascript", "rhino"} describing the language supported by the Script Engine. |
java.lang.String |
getOutputStatement(java.lang.String toDisplay)
Returns a String that can be used as a statement to display the specified String using the syntax of the supported scripting language. |
java.lang.Object |
getParameter(java.lang.String key)
Retrieves an associated value for the specified key. |
java.lang.String |
getProgram(java.lang.String[] statements)
Returns A valid scripting language executable progam with given statements. |
ScriptEngine |
getScriptEngine()
Retrieves an instance of the associated ScriptEngine. |
| Method Detail |
|---|
ScriptEngine getScriptEngine()
java.lang.String getEngineName()
java.lang.String getEngineVersion()
java.lang.String getLanguageName()
java.lang.String getLanguageVersion()
java.util.List getExtensions()
java.util.List getMimeTypes()
java.util.List getNames()
java.lang.Object getParameter(java.lang.String key)
java.lang.String getMethodCallSyntax(java.lang.String objectName,
java.lang.String method,
java.lang.String[] args)
public String getMethodCallSyntax(String objectName,
String method, String[] args) {
String ret = objectName;
ret += "." + method + "(";
for (int i = 0; i < args.length; i++) {
ret += args[i];
if (i == args.length - 1) {
ret += ")";
} else {
ret += ",";
}
}
return ret;
}
objectName - The name representing the object whose method is to be invoked.method - The name of the method to invoke.args - names of the arguments in the method call.
java.lang.String getOutputStatement(java.lang.String toDisplay)
public String getOutputStatement(String toDisplay) {
return "print(" + toDisplay + ")";
}
toDisplay - the string to be displayed
java.lang.String getProgram(java.lang.String[] statements)
public String getProgram(String... statements) {
$retval = "<?\n";
int len = statements.length;
for (int i = 0; i < len; i++) {
$retval += statements[i] + ";\n";
}
$retval += "?>";
}
statements - the statements to be executed,
e.g. as returned by the getMethodCallSyntax(java.lang.String, java.lang.String, java.lang.String[]) or getOutputStatement(java.lang.String) methods
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||