179 /** 180 * Returns a String that can be used as a statement to display the specified String using 181 * the syntax of the supported scripting language. For instance, the implementaton for a Perl 182 * engine might be; 183 * <p> 184 * <pre><code> 185 * public String getOutputStatement(String toDisplay) { 186 * return "print(" + toDisplay + ")"; 187 * } 188 * </code></pre> 189 * 190 * @param toDisplay The String to be displayed by the returned statement. 191 * @return The string used to display the String in the syntax of the scripting language. 192 * 193 * 194 */ 195 public String getOutputStatement(String toDisplay); 196 197 198 /** 199 * Returns A valid scripting language executable progam with given statements. 200 * For instance an implementation for a PHP engine might be: 201 * <p> 202 * <pre>{@code 203 * public String getProgram(String... statements) { 204 * $retval = "<?\n"; 205 * int len = statements.length; 206 * for (int i = 0; i < len; i++) { 207 * $retval += statements[i] + ";\n"; 208 * } 209 * $retval += "?>"; 210 * 211 * } 212 * }</pre> 213 * 214 * @param statements The statements to be executed. May be return values of 215 * calls to the <code>getMethodCallSyntax</code> and <code>getOutputStatement</code> methods. 216 * @return The Program 217 */ 218 219 public String getProgram(String... statements); 220 221 /** 222 * Returns an instance of the <code>ScriptEngine</code> associated with this 223 * <code>ScriptEngineFactory</code>. A new ScriptEngine is generally 224 * returned, but implementations may pool, share or reuse engines. 225 * 226 * @return A new <code>ScriptEngine</code> instance. 227 */ 228 public ScriptEngine getScriptEngine(); 229 } | 179 /** 180 * Returns a String that can be used as a statement to display the specified String using 181 * the syntax of the supported scripting language. For instance, the implementaton for a Perl 182 * engine might be; 183 * <p> 184 * <pre><code> 185 * public String getOutputStatement(String toDisplay) { 186 * return "print(" + toDisplay + ")"; 187 * } 188 * </code></pre> 189 * 190 * @param toDisplay The String to be displayed by the returned statement. 191 * @return The string used to display the String in the syntax of the scripting language. 192 * 193 * 194 */ 195 public String getOutputStatement(String toDisplay); 196 197 198 /** 199 * Returns a valid scripting language executable progam with given statements. 200 * For instance an implementation for a PHP engine might be: 201 * <p> 202 * <pre>{@code 203 * public String getProgram(String... statements) { 204 * String retval = "<?\n"; 205 * int len = statements.length; 206 * for (int i = 0; i < len; i++) { 207 * retval += statements[i] + ";\n"; 208 * } 209 * return retval += "?>"; 210 * } 211 * }</pre> 212 * 213 * @param statements The statements to be executed. May be return values of 214 * calls to the <code>getMethodCallSyntax</code> and <code>getOutputStatement</code> methods. 215 * @return The Program 216 */ 217 218 public String getProgram(String... statements); 219 220 /** 221 * Returns an instance of the <code>ScriptEngine</code> associated with this 222 * <code>ScriptEngineFactory</code>. A new ScriptEngine is generally 223 * returned, but implementations may pool, share or reuse engines. 224 * 225 * @return A new <code>ScriptEngine</code> instance. 226 */ 227 public ScriptEngine getScriptEngine(); 228 } |