// A Class: We need to create an instance for every call.
try {
return clazz.newInstance();
}
catch (Throwable ex) {
throw new ScriptCompilationException(
scriptSource, "Could not instantiate script class: " + clazz.getName(), ex);
}
}
else {
// Not a Class: We need to evaluate the script for every call.
return BshScriptUtils.createBshObject(
scriptSource.getScriptAsString(), actualInterfaces, this.beanClassLoader);
}
}
catch (EvalError ex) {
throw new ScriptCompilationException(scriptSource, ex);
}
}