- java.lang.Object
-
- javax.script.CompiledScript
-
public abstract class CompiledScript extends Object
Extended by classes that store results of compilations. State might be stored in the form of Java classes, Java class files or scripting language opcodes. The script may be executed repeatedly without reparsing.
EachCompiledScript
is associated with aScriptEngine
-- A call to aneval
method of theCompiledScript
causes the execution of the script by theScriptEngine
. Changes in the state of theScriptEngine
caused by execution of tneCompiledScript
may visible during subsequent executions of scripts by the engine.- Since:
- 1.6
-
-
Constructor Summary
Constructors Constructor and Description CompiledScript()
-
Method Summary
Methods Modifier and Type Method and Description Object
eval()
Executes the program stored in theCompiledScript
object.Object
eval(Bindings bindings)
Executes the program stored in theCompiledScript
object using the suppliedBindings
of attributes as theENGINE_SCOPE
of the associatedScriptEngine
during script execution.abstract Object
eval(ScriptContext context)
Executes the program stored in thisCompiledScript
object.abstract ScriptEngine
getEngine()
Returns theScriptEngine
whosecompile
method created thisCompiledScript
.
-
-
-
Method Detail
-
eval
public abstract Object eval(ScriptContext context) throws ScriptException
Executes the program stored in thisCompiledScript
object.- Parameters:
context
- AScriptContext
that is used in the same way as theScriptContext
passed to theeval
methods ofScriptEngine
.- Returns:
- The value returned by the script execution, if any. Should return
null
if no value is returned by the script execution. - Throws:
ScriptException
- if an error occurs.NullPointerException
- if context is null.
-
eval
public Object eval(Bindings bindings) throws ScriptException
Executes the program stored in theCompiledScript
object using the suppliedBindings
of attributes as theENGINE_SCOPE
of the associatedScriptEngine
during script execution. If bindings is null, then the effect of calling this method is same as that of eval(getEngine().getContext()).. The
GLOBAL_SCOPE
Bindings
,Reader
andWriter
associated with the defaultScriptContext
of the associatedScriptEngine
are used.- Parameters:
bindings
- The bindings of attributes used for theENGINE_SCOPE
.- Returns:
- The return value from the script execution
- Throws:
ScriptException
- if an error occurs.
-
eval
public Object eval() throws ScriptException
Executes the program stored in theCompiledScript
object. The defaultScriptContext
of the associatedScriptEngine
is used. The effect of calling this method is same as that of eval(getEngine().getContext()).- Returns:
- The return value from the script execution
- Throws:
ScriptException
- if an error occurs.
-
getEngine
public abstract ScriptEngine getEngine()
Returns theScriptEngine
whosecompile
method created thisCompiledScript
. TheCompiledScript
will execute in this engine.- Returns:
- The
ScriptEngine
that created thisCompiledScript
-
-
Traduction non disponible
Les API Java ne sont pas encore traduites en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.
Version en cache
26/11/2024 09:15:09 Cette version de la page est en cache (à la date du 26/11/2024 09:15:09) afin d'accélérer le traitement. Vous pouvez activer le mode utilisateur dans le menu en haut pour afficher la dernère version de la page.Document créé le 11/06/2005, dernière modification le 04/03/2020
Source du document imprimé : https://www.gaudry.be/java-api-rf-javax/script/CompiledScript.html
L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.
Références
Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.