code: public <T> T getInterface(ScriptWrapper script, Class<T> class1) throws ScriptException, IOException {
  	
  		ClassLoader previousContextClassLoader = Thread.currentThread().getContextClassLoader();
  		Thread.currentThread().setContextClassLoader(ExtensionFactory.getAddOnLoader());
  		try {
  			T iface = script.getInterface(class1);
  			
  			if (iface != null) {
  				// the script wrapper has overriden the usual scripting mechanism
  				return iface;
  			}
  		} finally {
  			Thread.currentThread().setContextClassLoader(previousContextClassLoader);
  		}
  		
  		if (script.isRunableStandalone()) {
  			return null;
  		}
  
  		Invocable invocable = invokeScript(script);
  		if (invocable != null) {
  			return invocable.getInterface(class1);
  		}
  		return null;
  
  	}
docs: Gets the interface {@code class1} from the given {@code script}. Might return {@code null} if the {@code script} does not
  implement the interface.
  <p>
  First tries to get the interface directly from the {@code script} by calling the method
  {@code ScriptWrapper.getInterface(Class)}, if it returns {@code null} the interface will be extracted from the script
  after invoking it, using the method {@code Invocable.getInterface(Class)}.
  <p>
  The context class loader of caller thread is replaced with the class loader {@code AddOnLoader} to allow the script to
  access classes of add-ons. If this behaviour is not desired call the method {@code getInterfaceWithOutAddOnLoader(}
  instead.
  
  @param script the script that will be invoked
  @param class1 the interface that will be obtained from the script
  @return the interface implemented by the script, or {@code null} if the {@code script} does not implement the interface.
  @throws ScriptException if the engine of the given {@code script} was not found.
  @throws IOException if an error occurred while obtaining the interface directly from the script (
  {@code ScriptWrapper.getInterface(Class)})
  @see #getInterfaceWithOutAddOnLoader(ScriptWrapper, Class)
  @see ScriptWrapper#getInterface(Class)
  @see Invocable#getInterface(Class)