map = Collections.unmodifiableMap(funcs);
}
public static BasicEvaluator getEvaluator(String name, FunctionArguments args, RecordPointer record) {
Constructor<? extends BasicEvaluator> c = map.get(name);
if (c == null) throw new SetupException(String.format("Unable to find requested basic evaluator %s.", name));
try {
try {
BasicEvaluator e = c.newInstance(record, args);
return e;
} catch (InvocationTargetException e) {
Throwable ex = e.getCause();
if (ex instanceof SetupException) {
throw (SetupException) ex;
} else {
if(ex instanceof RuntimeException){
throw (RuntimeException) ex;
}else{
throw new SetupException(String.format("Failure while attempting to create a new evaluator of type '%s'.", name));
}
}
}
} catch (RuntimeException | IllegalAccessException | InstantiationException ex) {
throw new SetupException(String.format("Failure while attempting to create a new evaluator of type '%s'.", name),
ex);
}
}