< prev index next >

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

Print this page




 199 
 200 
 201     /**
 202      * Returns a valid scripting language executable program with given statements.
 203      * For instance an implementation for a PHP engine might be:
 204      *
 205      * <pre>{@code
 206      * public String getProgram(String... statements) {
 207      *      String retval = "<?\n";
 208      *      int len = statements.length;
 209      *      for (int i = 0; i < len; i++) {
 210      *          retval += statements[i] + ";\n";
 211      *      }
 212      *      return retval += "?>";
 213      * }
 214      * }</pre>
 215      *
 216      *  @param statements The statements to be executed.  May be return values of
 217      *  calls to the <code>getMethodCallSyntax</code> and <code>getOutputStatement</code> methods.
 218      *  @return The Program


 219      */
 220 
 221     public String getProgram(String... statements);
 222 
 223     /**
 224      * Returns an instance of the <code>ScriptEngine</code> associated with this
 225      * <code>ScriptEngineFactory</code>. A new ScriptEngine is generally
 226      * returned, but implementations may pool, share or reuse engines.
 227      *
 228      * @return A new <code>ScriptEngine</code> instance.
 229      */
 230     public  ScriptEngine getScriptEngine();
 231 }


 199 
 200 
 201     /**
 202      * Returns a valid scripting language executable program with given statements.
 203      * For instance an implementation for a PHP engine might be:
 204      *
 205      * <pre>{@code
 206      * public String getProgram(String... statements) {
 207      *      String retval = "<?\n";
 208      *      int len = statements.length;
 209      *      for (int i = 0; i < len; i++) {
 210      *          retval += statements[i] + ";\n";
 211      *      }
 212      *      return retval += "?>";
 213      * }
 214      * }</pre>
 215      *
 216      *  @param statements The statements to be executed.  May be return values of
 217      *  calls to the <code>getMethodCallSyntax</code> and <code>getOutputStatement</code> methods.
 218      *  @return The Program
 219      *
 220      *  @throws NullPointerException if the <code>statements</code> array or any of its elements is null
 221      */
 222 
 223     public String getProgram(String... statements);
 224 
 225     /**
 226      * Returns an instance of the <code>ScriptEngine</code> associated with this
 227      * <code>ScriptEngineFactory</code>. A new ScriptEngine is generally
 228      * returned, but implementations may pool, share or reuse engines.
 229      *
 230      * @return A new <code>ScriptEngine</code> instance.
 231      */
 232     public  ScriptEngine getScriptEngine();
 233 }
< prev index next >