Skip to content

Utilities

vasanth-asokan edited this page Jan 30, 2015 · 2 revisions

ScriptModuleUtils contains a set of utility methods for working with a Nicobar ScriptModule. There are methods to find classes implementing an interface, or extending from other classes, which is typically how you find a class of interest from a module. For example, here is how you can find a Callable out of a ScriptModule and execute it.

Class<?> callable = ScriptModuleUtils.findAssignableClass(scriptModule, Callable.class);
@SuppressWarnings("unchecked")
Callable<String> instance = (Callable<String>) callable.newInstance();
String result = instance.call();