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
|
||||
*/
|
||||
private String visibility(Options opt, ProgramElementDoc e) {
|
||||
if (!opt.showVisibility)
|
||||
return " ";
|
||||
if (e.isPrivate())
|
||||
return "- ";
|
||||
else if (e.isPublic())
|
||||
return "+ ";
|
||||
else if (e.isProtected())
|
||||
return "# ";
|
||||
else if (e.isPackagePrivate())
|
||||
return "~ ";
|
||||
else
|
||||
return " ";
|
||||
return opt.showVisibility ? Visibility.get(e).symbol : " ";
|
||||
}
|
||||
|
||||
/** 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
|
||||
* private visibility is referred as PACKAGE.
|
||||
* @author wolf
|
||||
*
|
||||
*/
|
||||
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) {
|
||||
if (doc.isPrivate())
|
||||
|
|
@ -38,6 +43,5 @@ public enum Visibility {
|
|||
return PROTECTED;
|
||||
else
|
||||
return PUBLIC;
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue