115 * @return The value returned from the execution of the script. 116 * 117 * @throws ScriptException if an error occurs in script. ScriptEngines should create and throw 118 * <code>ScriptException</code> wrappers for checked Exceptions thrown by underlying scripting 119 * implementations. 120 * @throws NullPointerException if either argument is null. 121 */ 122 public Object eval(String script, ScriptContext context) throws ScriptException; 123 124 125 /** 126 * Same as <code>eval(String, ScriptContext)</code> where the source of the script 127 * is read from a <code>Reader</code>. 128 * 129 * @param reader The source of the script to be executed by the script engine. 130 * 131 * @param context The <code>ScriptContext</code> passed to the script engine. 132 * 133 * @return The value returned from the execution of the script. 134 * 135 * @throws ScriptException if an error occurs in script. 136 * @throws NullPointerException if either argument is null. 137 */ 138 public Object eval(Reader reader , ScriptContext context) throws ScriptException; 139 140 /** 141 * Executes the specified script. The default <code>ScriptContext</code> for the <code>ScriptEngine</code> 142 * is used. 143 * 144 * @param script The script language source to be executed. 145 * 146 * @return The value returned from the execution of the script. 147 * 148 * @throws ScriptException if error occurs in script. 149 * @throws NullPointerException if the argument is null. 150 */ 151 public Object eval(String script) throws ScriptException; 152 153 /** 154 * Same as <code>eval(String)</code> except that the source of the script is 155 * provided as a <code>Reader</code> 156 * 157 * @param reader The source of the script. 158 * 159 * @return The value returned by the script. 160 * 161 * @throws ScriptException if an error occurs in script. 162 * @throws NullPointerException if the argument is null. 163 */ 164 public Object eval(Reader reader) throws ScriptException; 165 166 /** 167 * Executes the script using the <code>Bindings</code> argument as the <code>ENGINE_SCOPE</code> 168 * <code>Bindings</code> of the <code>ScriptEngine</code> during the script execution. The 169 * <code>Reader</code>, <code>Writer</code> and non-<code>ENGINE_SCOPE</code> <code>Bindings</code> of the 170 * default <code>ScriptContext</code> are used. The <code>ENGINE_SCOPE</code> 171 * <code>Bindings</code> of the <code>ScriptEngine</code> is not changed, and its 172 * mappings are unaltered by the script execution. 173 * 174 * @param script The source for the script. 175 * 176 * @param n The <code>Bindings</code> of attributes to be used for script execution. 177 * 178 * @return The value returned by the script. 179 * 180 * @throws ScriptException if an error occurs in script. 181 * @throws NullPointerException if either argument is null. 182 */ 183 public Object eval(String script, Bindings n) throws ScriptException; 184 185 /** 186 * Same as <code>eval(String, Bindings)</code> except that the source of the script 187 * is provided as a <code>Reader</code>. 188 * 189 * @param reader The source of the script. 190 * @param n The <code>Bindings</code> of attributes. 191 * 192 * @return The value returned by the script. 193 * 194 * @throws ScriptException if an error occurs. 195 * @throws NullPointerException if either argument is null. 196 */ 197 public Object eval(Reader reader , Bindings n) throws ScriptException; 198 199 200 201 /** 202 * Sets a key/value pair in the state of the ScriptEngine that may either create 203 * a Java Language Binding to be used in the execution of scripts or be used in some 204 * other way, depending on whether the key is reserved. Must have the same effect as 205 * <code>getBindings(ScriptContext.ENGINE_SCOPE).put</code>. 206 * 207 * @param key The name of named value to add 208 * @param value The value of named value to add. 209 * 210 * @throws NullPointerException if key is null. 211 * @throws IllegalArgumentException if key is empty. 212 */ 213 public void put(String key, Object value); 214 | 115 * @return The value returned from the execution of the script. 116 * 117 * @throws ScriptException if an error occurs in script. ScriptEngines should create and throw 118 * <code>ScriptException</code> wrappers for checked Exceptions thrown by underlying scripting 119 * implementations. 120 * @throws NullPointerException if either argument is null. 121 */ 122 public Object eval(String script, ScriptContext context) throws ScriptException; 123 124 125 /** 126 * Same as <code>eval(String, ScriptContext)</code> where the source of the script 127 * is read from a <code>Reader</code>. 128 * 129 * @param reader The source of the script to be executed by the script engine. 130 * 131 * @param context The <code>ScriptContext</code> passed to the script engine. 132 * 133 * @return The value returned from the execution of the script. 134 * 135 * @throws ScriptException if an error occurs in script. ScriptEngines should create and throw 136 * <code>ScriptException</code> wrappers for checked Exceptions thrown by underlying scripting 137 * implementations. 138 * @throws NullPointerException if either argument is null. 139 */ 140 public Object eval(Reader reader , ScriptContext context) throws ScriptException; 141 142 /** 143 * Executes the specified script. The default <code>ScriptContext</code> for the <code>ScriptEngine</code> 144 * is used. 145 * 146 * @param script The script language source to be executed. 147 * 148 * @return The value returned from the execution of the script. 149 * 150 * @throws ScriptException if an error occurs in script. ScriptEngines should create and throw 151 * <code>ScriptException</code> wrappers for checked Exceptions thrown by underlying scripting 152 * implementations. 153 * @throws NullPointerException if the argument is null. 154 */ 155 public Object eval(String script) throws ScriptException; 156 157 /** 158 * Same as <code>eval(String)</code> except that the source of the script is 159 * provided as a <code>Reader</code> 160 * 161 * @param reader The source of the script. 162 * 163 * @return The value returned by the script. 164 * 165 * @throws ScriptException if an error occurs in script. ScriptEngines should create and throw 166 * <code>ScriptException</code> wrappers for checked Exceptions thrown by underlying scripting 167 * implementations. 168 * @throws NullPointerException if the argument is null. 169 */ 170 public Object eval(Reader reader) throws ScriptException; 171 172 /** 173 * Executes the script using the <code>Bindings</code> argument as the <code>ENGINE_SCOPE</code> 174 * <code>Bindings</code> of the <code>ScriptEngine</code> during the script execution. The 175 * <code>Reader</code>, <code>Writer</code> and non-<code>ENGINE_SCOPE</code> <code>Bindings</code> of the 176 * default <code>ScriptContext</code> are used. The <code>ENGINE_SCOPE</code> 177 * <code>Bindings</code> of the <code>ScriptEngine</code> is not changed, and its 178 * mappings are unaltered by the script execution. 179 * 180 * @param script The source for the script. 181 * 182 * @param n The <code>Bindings</code> of attributes to be used for script execution. 183 * 184 * @return The value returned by the script. 185 * 186 * @throws ScriptException if an error occurs in script. ScriptEngines should create and throw 187 * <code>ScriptException</code> wrappers for checked Exceptions thrown by underlying scripting 188 * implementations. 189 * @throws NullPointerException if either argument is null. 190 */ 191 public Object eval(String script, Bindings n) throws ScriptException; 192 193 /** 194 * Same as <code>eval(String, Bindings)</code> except that the source of the script 195 * is provided as a <code>Reader</code>. 196 * 197 * @param reader The source of the script. 198 * @param n The <code>Bindings</code> of attributes. 199 * 200 * @return The value returned by the script. 201 * 202 * @throws ScriptException if an error occurs in script. ScriptEngines should create and throw 203 * <code>ScriptException</code> wrappers for checked Exceptions thrown by underlying scripting 204 * implementations. 205 * @throws NullPointerException if either argument is null. 206 */ 207 public Object eval(Reader reader , Bindings n) throws ScriptException; 208 209 210 211 /** 212 * Sets a key/value pair in the state of the ScriptEngine that may either create 213 * a Java Language Binding to be used in the execution of scripts or be used in some 214 * other way, depending on whether the key is reserved. Must have the same effect as 215 * <code>getBindings(ScriptContext.ENGINE_SCOPE).put</code>. 216 * 217 * @param key The name of named value to add 218 * @param value The value of named value to add. 219 * 220 * @throws NullPointerException if key is null. 221 * @throws IllegalArgumentException if key is empty. 222 */ 223 public void put(String key, Object value); 224 |