boolean inclusionRequired = false;
if (doc instanceof PackageDoc) {
// nested nodes are classes, therefore check, if the
// package contains any classes to be documented
PackageDoc pd = (PackageDoc) dynamicProxyInstance();
inclusionRequired = pd.allClasses().length > 0;
} else if (doc instanceof ClassDoc) {
// nested nodes are constructors, methods or fields.
ClassDoc cd = (ClassDoc) dynamicProxyInstance();
inclusionRequired =
cd.constructors().length > 0 ||