return result[0];
}
}
// try "UiBinder.createInstance" script
{
ComponentDescription description = ComponentDescriptionHelper.getDescription(context, clazz);
// prepare script
String script;
{
String scriptObject[] = {null};
context.getBroadcastSupport().getListener(CreateObjectScript.class).invoke(
objectName,
clazz,
args,
scriptObject);
script = scriptObject[0];
}
if (script == null) {
script = description.getParameter("UiBinder.createInstance");
}
// try to use script
if (script != null) {
ClassLoader classLoader = context.getClassLoader();
Map<String, Object> variables = Maps.newTreeMap();
variables.put("wbpClassLoader", UiBinderParser.class.getClassLoader());
variables.put("classLoader", classLoader);
variables.put("componentClass", clazz);
variables.put("objectName", objectName);
variables.put("modelClass", description.getModelClass());
variables.put("modelClassLoader", description.getModelClass().getClassLoader());
variables.put("args", args);
Object result = ScriptUtils.evaluate(classLoader, script, variables);
return result;
}
}