Add -hideprivateinner option

This commit is contained in:
Erich Schubert 2018-11-03 21:39:36 +01:00
parent 0ba1798ac5
commit 0967a91289
4 changed files with 24 additions and 17 deletions

View File

@ -16,6 +16,7 @@ the default is off, and it will not inherit from <code>-qualify</code>.</li>
<li>Use &lt;i&gt; tags for italic, because the old font naming approach does not work with SVG anymore.
Replace <code>-nodefontabstractname</code> and <code>-nodefontclassabstractname</code>
with a simple flag <code>-nodefontabstractitalic</code> instead.</li>
<li>Added <code>-hideprivateinner</code> to hide all private inner classes.</li>
</ul>
</dd>

View File

@ -326,9 +326,11 @@ class ClassGraph {
/** Return true if c has a @hidden tag associated with it */
private boolean hidden(ProgramElementDoc c) {
return c.tags("hidden").length > 0 || c.tags("view").length > 0 || //
optionProvider.getOptionsFor(c instanceof ClassDoc ? (ClassDoc) c : c.containingClass()) //
.matchesHideExpression(c.toString());
if (c.tags("hidden").length > 0 || c.tags("view").length > 0)
return true;
Options opt = optionProvider.getOptionsFor(c instanceof ClassDoc ? (ClassDoc) c : c.containingClass());
return opt.matchesHideExpression(c.toString()) //
|| (opt.hidePrivateInner && c instanceof ClassDoc && c.isPrivate() && ((ClassDoc) c).containingClass() != null);
}
protected ClassInfo getClassInfo(ClassDoc cd, boolean create) {

View File

@ -115,6 +115,7 @@ public class Options implements Cloneable, OptionProvider {
RelationType inferRelationshipType = RelationType.NAVASSOC;
private List<Pattern> collPackages = new ArrayList<Pattern>();
boolean compact = false;
boolean hidePrivateInner = false;
// internal option, used by UMLDoc to generate relative links between classes
boolean relativeLinksForSourcePackages = false;
// internal option, used by UMLDoc to force strict matching on the class names
@ -193,6 +194,7 @@ public class Options implements Cloneable, OptionProvider {
matchOption(option, "qualifyGenerics", true) ||
matchOption(option, "hideGenerics", true) ||
matchOption(option, "horizontal", true) ||
matchOption(option, "all") ||
matchOption(option, "attributes", true) ||
matchOption(option, "enumconstants", true) ||
matchOption(option, "operations", true) ||
@ -203,16 +205,16 @@ public class Options implements Cloneable, OptionProvider {
matchOption(option, "autosize", true) ||
matchOption(option, "commentname", true) ||
matchOption(option, "nodefontabstractitalic", true) ||
matchOption(option, "all") ||
matchOption(option, "postfixpackage") ||
matchOption(option, "noguillemot") ||
matchOption(option, "views") ||
matchOption(option, "inferrel") ||
matchOption(option, "useimports") ||
matchOption(option, "collapsible") ||
matchOption(option, "inferdep") ||
matchOption(option, "inferdepinpackage") ||
matchOption(option, "compact"))
matchOption(option, "postfixpackage", true) ||
matchOption(option, "noguillemot", true) ||
matchOption(option, "views", true) ||
matchOption(option, "inferrel", true) ||
matchOption(option, "useimports", true) ||
matchOption(option, "collapsible", true) ||
matchOption(option, "inferdep", true) ||
matchOption(option, "inferdepinpackage", true) ||
matchOption(option, "hideprivateinner", true) ||
matchOption(option, "compact", true))
return 1;
else if(matchOption(option, "nodefillcolor") ||
@ -396,6 +398,8 @@ public class Options implements Cloneable, OptionProvider {
inferDependencies = positive;
} else if(matchOption(opt[0], "inferdepinpackage", true)) {
inferDepInPackage = positive;
} else if (matchOption(opt[0], "hideprivateinner", true)) {
hidePrivateInner = positive;
} else if(matchOption(opt[0], "useimports", true)) {
useImports = positive;
} else if (matchOption(opt[0], "collpackages", true)) {

View File

@ -63,8 +63,8 @@ public class PackageView implements OptionProvider {
boolean inPackage = matcher.matches(cd);
if (inPackage)
opt.showQualified = false;
if (!(inPackage || this.opt.matchesIncludeExpression(cd.qualifiedName()))
|| this.opt.matchesHideExpression(cd.qualifiedName()))
boolean included = inPackage || this.opt.matchesIncludeExpression(cd.qualifiedName());
if (!included || this.opt.matchesHideExpression(cd.qualifiedName()))
opt.setOption(HIDE);
}
@ -73,8 +73,8 @@ public class PackageView implements OptionProvider {
boolean inPackage = matcher.matches(className);
if (inPackage)
opt.showQualified = false;
if (!(inPackage || this.opt.matchesIncludeExpression(className))
|| this.opt.matchesHideExpression(className))
boolean included = inPackage || this.opt.matchesIncludeExpression(className);
if (!included || this.opt.matchesHideExpression(className))
opt.setOption(HIDE);
}