Home
Categories
Dictionary
Download
Project Details
Changes Log
FAQ
License

Installing a script



Installing a script file can be performed from:
  • A script file
  • A string containing the script content

Installing a script file

Installing a script file is performed through the ScriptWrapper.installScript(File).

For example:
      File file = new File(<our script file>);
      wrapper.installScript(file);
Note that you can perform again this method on the same ScriptWrapper instance if you want to change the Script. For example this will work:
      ScriptWrapper<Script> wrapper = new GroovyScriptWrapper<Script>() {
      };
      Script Script = wrapper.getScript();

      File file = new File(<our first script file>);
      wrapper.installScript(file);
      int value = script.execute(10);

      file = new File(<our second script file>);
      value = script.execute(10);

Installing a script from a String

It is also possible to install a Script from a String rather than a file. For example:
      String theContent = "...the script content"
      wrapper.installScript(theContent);

See also


Categories: api

Copyright 2019-2020 Herve Girod. All Rights Reserved. Documentation and source under the BSD licence