1 package net.sf.clirr.core.spi;
2
3 /***
4 * Enumeration type that represents an "accessibility" level for
5 * a java class, field or method.
6 * <p>
7 * Change of access rights from lower to higher visibility rating is a
8 * binary-compatible change. Change of access rights from higher to
9 * lower is a binary-incompatible change.
10 * <p>
11 * Public > Protected > Package > Private
12 *
13 * @author Simon Kitching
14 */
15 public final class Scope
16 {
17 private int vis;
18 private String desc;
19 private String decl;
20
21 /*** Object representing private scoped objects. */
22 public static final Scope PRIVATE = new Scope(0, "private", "private");
23
24 /**</package-summary/html">Object representing package scoped objects/ *//package-summary.html">em>* Object representing package scoped objects. */
25 public static final Scope PACKAGE = new Scope(1, "package", "");
26
27 /*** Object representing protected scoped objects. */
28 public static final Scope PROTECTED = new Scope(2, "protected", "protected");
29
30 /*** Object representing public scoped objects. */
31 public static final Scope PUBLIC = new Scope(3, "public", "public");
32
33 private Scope(int vis, String desc, String decl)
34 {
35 this.vis = vis;
36 this.desc = desc;
37 this.decl = decl;
38 }
39
40 public boolean isMoreVisibleThan(Scope v)
41 {
42 return this.vis > v.vis;
43 }
44
45 public boolean isLessVisibleThan(Scope v)
46 {
47 return this.vis < v.vis;
48 }
49
50 public String getDesc()
51 {
52 return desc;
53 }
54
55 /*** the Java visibility modifier. **/
56 public String getDecl()
57 {
58 return decl;
59 }
60 }