mirror of https://github.com/dspinellis/UMLGraph
Move visibility symbols into Visibility class.
This commit is contained in:
parent
a4ab6f179a
commit
9ddf84129a
|
|
@ -167,18 +167,7 @@ class ClassGraph {
|
||||||
* any stereotypes
|
* any stereotypes
|
||||||
*/
|
*/
|
||||||
private String visibility(Options opt, ProgramElementDoc e) {
|
private String visibility(Options opt, ProgramElementDoc e) {
|
||||||
if (!opt.showVisibility)
|
return opt.showVisibility ? Visibility.get(e).symbol : " ";
|
||||||
return " ";
|
|
||||||
if (e.isPrivate())
|
|
||||||
return "- ";
|
|
||||||
else if (e.isPublic())
|
|
||||||
return "+ ";
|
|
||||||
else if (e.isProtected())
|
|
||||||
return "# ";
|
|
||||||
else if (e.isPackagePrivate())
|
|
||||||
return "~ ";
|
|
||||||
else
|
|
||||||
return " ";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Print the method parameter p */
|
/** Print the method parameter p */
|
||||||
|
|
|
||||||
|
|
@ -24,10 +24,15 @@ import com.sun.javadoc.ProgramElementDoc;
|
||||||
* Enumerates the possible visibilities in a Java program. For brevity, package
|
* Enumerates the possible visibilities in a Java program. For brevity, package
|
||||||
* private visibility is referred as PACKAGE.
|
* private visibility is referred as PACKAGE.
|
||||||
* @author wolf
|
* @author wolf
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public enum Visibility {
|
public enum Visibility {
|
||||||
PRIVATE, PACKAGE, PROTECTED, PUBLIC;
|
PRIVATE("- "), PACKAGE("~ "), PROTECTED("# "), PUBLIC("+ ");
|
||||||
|
|
||||||
|
final public String symbol;
|
||||||
|
|
||||||
|
private Visibility(String symbol) {
|
||||||
|
this.symbol = symbol;
|
||||||
|
}
|
||||||
|
|
||||||
public static Visibility get(ProgramElementDoc doc) {
|
public static Visibility get(ProgramElementDoc doc) {
|
||||||
if (doc.isPrivate())
|
if (doc.isPrivate())
|
||||||
|
|
@ -38,6 +43,5 @@ public enum Visibility {
|
||||||
return PROTECTED;
|
return PROTECTED;
|
||||||
else
|
else
|
||||||
return PUBLIC;
|
return PUBLIC;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue