Constructor<T> constructor = type.getDeclaredConstructor(configType);
constructor.setAccessible(true);
return constructor.newInstance(config);
}
catch (NoSuchMethodException e) {
throw new JbpmException(type
+ " does not have a "
+ config.getClass().getSimpleName()
+ " constructor", e);
}
catch (InstantiationException e) {
throw new JbpmException("could not instantiate " + type, e);
}
catch (IllegalAccessException e) {
throw new JbpmException(type + " is inaccessible", e);
}
catch (IllegalArgumentException e) {
throw new JbpmException(type + " cannot be constructed with value " + config, e);
}
catch (InvocationTargetException e) {
throw new JbpmException("constructor for " + type + " threw exception", e.getCause());
}
}