private void invokeUiChildMethod(T wrapped, List<IsWidget> childWidgets,
UiChildMethodHolder uiChildMethodHolder) {
if (uiChildMethodHolder.invocationLimit > -1
&& uiChildMethodHolder.invocationCount > uiChildMethodHolder.invocationLimit) {
throw new GwtTestUiBinderException("@UiChild method '"
+ uiChildMethodHolder.uiChildMethod.toGenericString()
+ "' cannot be invoked more than " + uiChildMethodHolder.invocationLimit
+ " times");
} else if (childWidgets.size() != 1) {
throw new GwtTestUiBinderException("@UiChild method '"
+ uiChildMethodHolder.uiChildMethod.toGenericString()
+ "' can only be applied to add one Widget, but " + childWidgets.size()
+ " have been found");
}
try {
uiChildMethodHolder.uiChildMethod.invoke(wrapped, childWidgets.get(0));
} catch (Exception e) {
throw new GwtTestUiBinderException(
"An exception has been thrown during invocation of @UiChild method: "
+ uiChildMethodHolder.uiChildMethod.toGenericString(), e);
}
uiChildMethodHolder.invocationCount++;
}