Author: sebb
Date: Wed Mar 25 02:04:17 2009
New Revision: 758126

URL: http://svn.apache.org/viewvc?rev=758126&view=rev
Log:
More Javadoc

Modified:
    
jakarta/bsf/trunk/bsf3/bsf-api/src/main/java/javax/script/ScriptEngineFactory.java

Modified: 
jakarta/bsf/trunk/bsf3/bsf-api/src/main/java/javax/script/ScriptEngineFactory.java
URL: 
http://svn.apache.org/viewvc/jakarta/bsf/trunk/bsf3/bsf-api/src/main/java/javax/script/ScriptEngineFactory.java?rev=758126&r1=758125&r2=758126&view=diff
==============================================================================
--- 
jakarta/bsf/trunk/bsf3/bsf-api/src/main/java/javax/script/ScriptEngineFactory.java
 (original)
+++ 
jakarta/bsf/trunk/bsf3/bsf-api/src/main/java/javax/script/ScriptEngineFactory.java
 Wed Mar 25 02:04:17 2009
@@ -99,9 +99,66 @@
      */
     public Object getParameter(String key);    
 
-    public String getMethodCallSyntax(String obj, String method, 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. 
+     * For instance, an implementaton for a Javascript engine might be;
+     * <pre>
+     *  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;
+     *  }
+     * </pre>
+     * @param objectName The name representing the object whose method is to 
be invoked.
+     * @param method The name of the method to invoke.
+     * @param args names of the arguments in the method call. 
+     * @return The String used to invoke the method in the syntax of the 
scripting language.
+     */
+    public String getMethodCallSyntax(String objectName, String method, 
String[] args);
 
+    /**
+     * Returns a String that can be used as a statement to display 
+     * the specified String using the syntax of the supported 
+     * scripting language. For instance, the implementaton for a 
+     * Perl engine might be;
+     * <pre> 
+     * public String getOutputStatement(String toDisplay) {
+     *       return "print(" + toDisplay + ")";
+     *  }
+     *  </pre>
+     * @param toDisplay the string to be displayed
+     * 
+     * @return The string used to display the String in the syntax of 
+     * the scripting language.
+     */
     public String getOutputStatement(String toDisplay);
 
+    /**
+     * Returns A valid scripting language executable progam with 
+     * given statements. For instance an implementation for a PHP 
+     * engine might be:
+     * <pre> 
+     *  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
+     * @return The Program
+     */
     public String getProgram(String[] statements);
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: bsf-dev-unsubscr...@jakarta.apache.org
For additional commands, e-mail: bsf-dev-h...@jakarta.apache.org

Reply via email to