private Object extractResource(String group, UiResourceManager resourceManager, Object owner) {
String[] splitted = group.split("\\.");
String resourceAlias = splitted[0];
Object resource = resourceManager.getUiResource(resourceAlias);
if (resource == null) {
throw new GwtTestUiBinderException("Error in file '" + owner.getClass().getSimpleName()
+ ".ui.xml' : no resource declared for alias '" + resourceAlias + "'");
}
if (splitted.length == 1) {
return resource;
}
// handle "alias.myDataResource.getUrl"
try {
for (int i = 1; i < splitted.length; i++) {
if (CssResource.class.isInstance(resource)) {
// special case of css styles
return splitted[i];
} else {
resource = GwtReflectionUtils.callPrivateMethod(resource, splitted[i]);
}
}
return resource;
} catch (Exception e) {
if (GwtTestException.class.isInstance(e)) {
throw (GwtTestException) e;
} else {
throw new GwtTestUiBinderException("Error while calling property '"
+ group.substring(group.indexOf('.') + 1) + "' on object of type '"
+ resourceManager.getUiResource(resourceAlias).getClass().getName() + "'", e);
}
}
}