private Context createContextForControl(Map<String, Object> params, String component, String... exports)
throws Exception {
Method method = getAccessibleMethod(tool.getClass(), "createContextForControl", new Class<?>[] {
ControlParameters.class, String.class });
ControlParameters controlParameters = new ControlParameters();
if (params != null) {
controlParameters.putAll(params);
}
if (exports != null) {
getAccessibleField(controlParameters.getClass(), "exportVars").set(controlParameters,
createHashSet(exports));
}
return (Context) method.invoke(tool, controlParameters, component);
}