{
clazz = resolution.resolveClass(hookClass);
}
catch (EngineImportException e)
{
throw new ExprValidationException("Failed to resolve hook provider of hook type '" + hookType +
"' import '" + hookClass + "' :" + e.getMessage());
}
if (!JavaClassHelper.isImplementsInterface(clazz, interfaceExpected)) {
throw new ExprValidationException("Hook provider for hook type '" + hookType + "' " +
"class '" + clazz.getName() + "' does not implement the required '" + interfaceExpected.getSimpleName() +
"' interface");
}
Object hook;
try
{
hook = clazz.newInstance();
}
catch (Exception e)
{
throw new ExprValidationException("Failed to instantiate hook provider of hook type '" + hookType + "' " +
"class '" + clazz.getName() + "' :" + e.getMessage());
}
return hook;
}