- 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.
EachCompiledScriptis associated with aScriptEngine-- A call to anevalmethod of theCompiledScriptcauses the execution of the script by theScriptEngine. Changes in the state of theScriptEnginecaused by execution of tneCompiledScriptmay 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 Objecteval()Executes the program stored in theCompiledScriptobject.Objecteval(Bindings bindings)Executes the program stored in theCompiledScriptobject using the suppliedBindingsof attributes as theENGINE_SCOPEof the associatedScriptEngineduring script execution.abstract Objecteval(ScriptContext context)Executes the program stored in thisCompiledScriptobject.abstract ScriptEnginegetEngine()Returns theScriptEnginewhosecompilemethod created thisCompiledScript.
-
-
-
Method Detail
-
eval
public abstract Object eval(ScriptContext context) throws ScriptException
Executes the program stored in thisCompiledScriptobject.- Parameters:
context- AScriptContextthat is used in the same way as theScriptContextpassed to theevalmethods ofScriptEngine.- Returns:
- The value returned by the script execution, if any. Should return
nullif 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 theCompiledScriptobject using the suppliedBindingsof attributes as theENGINE_SCOPEof the associatedScriptEngineduring script execution. If bindings is null, then the effect of calling this method is same as that of eval(getEngine().getContext()).. The
GLOBAL_SCOPEBindings,ReaderandWriterassociated with the defaultScriptContextof the associatedScriptEngineare 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 theCompiledScriptobject. The defaultScriptContextof the associatedScriptEngineis 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 theScriptEnginewhosecompilemethod created thisCompiledScript. TheCompiledScriptwill execute in this engine.- Returns:
- The
ScriptEnginethat created thisCompiledScript
-
-
Nederlandse vertaling
U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.
Bij voorbaat dank.
Document heeft de 11/06/2005 gemaakt, de laatste keer de 04/03/2020 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-rf-javax/script/compiledscript.html
De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.
Referenties
Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur van deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.