if (addToParentMethod == null) {
if (childCollection instanceof Collection) {
Collection col = (Collection) childCollection;
col.add( child );
} else {
throw new CrankException(methodNotFoundException, "Unable to add child %s to parent %s because %s",
child, parent, methodNotFoundException.getMessage());
}
}
return;
}
}
/*
* Invoke the addMethod on parent passing the child as an argument.
*/
addToParentMethod.invoke(parent, new Object[]{child});
} catch (Exception ex) {
/* If there are any problems throw a nested exception. */
throw new CrankException(ex, "Unable to add child to parent");
}
}