src/share/classes/javax/script/ScriptEngineFactory.java

Print this page

        

*** 142,153 **** /** * Returns a String which can be used to invoke a method of a Java object using the syntax * of the supported scripting language. For instance, an implementaton for a Javascript * engine might be; * <p> ! * <pre> ! * <code> * public String getMethodCallSyntax(String obj, * String m, String... args) { * String ret = obj; * ret += "." + m + "("; * for (int i = 0; i < args.length; i++) { --- 142,152 ---- /** * Returns a String which can be used to invoke a method of a Java object using the syntax * of the supported scripting language. For instance, an implementaton for a Javascript * engine might be; * <p> ! * <pre>{@code * public String getMethodCallSyntax(String obj, * String m, String... args) { * String ret = obj; * ret += "." + m + "("; * for (int i = 0; i < args.length; i++) {
*** 157,168 **** * } * } * ret += ")"; * return ret; * } ! *</code> ! *</pre> * <p> * * @param obj The name representing the object whose method is to be invoked. The * name is the one used to create bindings using the <code>put</code> method of * <code>ScriptEngine</code>, the <code>put</code> method of an <code>ENGINE_SCOPE</code> --- 156,166 ---- * } * } * ret += ")"; * return ret; * } ! * } </pre> * <p> * * @param obj The name representing the object whose method is to be invoked. The * name is the one used to create bindings using the <code>put</code> method of * <code>ScriptEngine</code>, the <code>put</code> method of an <code>ENGINE_SCOPE</code>
*** 198,218 **** /** * Returns A valid scripting language executable progam with given statements. * For instance an implementation for a PHP engine might be: * <p> ! * <pre><code> * public String getProgram(String... statements) { ! * $retval = "&lt;?\n"; * int len = statements.length; * for (int i = 0; i < len; i++) { * $retval += statements[i] + ";\n"; * } ! * $retval += "?&gt;"; * * } ! * </code></pre> * * @param statements The statements to be executed. May be return values of * calls to the <code>getMethodCallSyntax</code> and <code>getOutputStatement</code> methods. * @return The Program */ --- 196,216 ---- /** * Returns A valid scripting language executable progam with given statements. * For instance an implementation for a PHP engine might be: * <p> ! * <pre>{@code * public String getProgram(String... statements) { ! * $retval = "<?\n"; * int len = statements.length; * for (int i = 0; i < len; i++) { * $retval += statements[i] + ";\n"; * } ! * $retval += "?>"; * * } ! * }</pre> * * @param statements The statements to be executed. May be return values of * calls to the <code>getMethodCallSyntax</code> and <code>getOutputStatement</code> methods. * @return The Program */