Skip to content

Commit

Permalink
Add -hideprivateinner option
Browse files Browse the repository at this point in the history
  • Loading branch information
kno10 committed Nov 3, 2018
1 parent 0ba1798 commit 0967a91
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 17 deletions.
1 change: 1 addition & 0 deletions doc/ver.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
8 changes: 5 additions & 3 deletions src/main/java/org/umlgraph/doclet/ClassGraph.java
Original file line number Diff line number Diff line change
Expand Up @@ -326,9 +326,11 @@ private void stereotype(Options opt, Doc c, Align align) {

/** 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) {
Expand Down
24 changes: 14 additions & 10 deletions src/main/java/org/umlgraph/doclet/Options.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -193,6 +194,7 @@ public static int optionLength(String option) {
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) ||
Expand All @@ -203,16 +205,16 @@ public static int optionLength(String option) {
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") ||
Expand Down Expand Up @@ -396,6 +398,8 @@ void setOption(String[] opt) {
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)) {
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/org/umlgraph/doclet/PackageView.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ public void overrideForClass(Options opt, ClassDoc cd) {
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);
}

Expand All @@ -73,8 +73,8 @@ public void overrideForClass(Options opt, String className) {
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);
}

Expand Down

0 comments on commit 0967a91

Please sign in to comment.