01: package net.sf.clirr.core.spi;
02:
03: /**
04: * Enumeration type that represents an "accessibility" level for
05: * a java class, field or method.
06: * <p>
07: * Change of access rights from lower to higher visibility rating is a
08: * binary-compatible change. Change of access rights from higher to
09: * 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: private int vis;
17: private String desc;
18: private String decl;
19:
20: /** Object representing private scoped objects. */
21: public static final Scope PRIVATE = new Scope(0, "private",
22: "private");
23:
24: /** 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",
29: "protected");
30:
31: /** Object representing public scoped objects. */
32: public static final Scope PUBLIC = new Scope(3, "public", "public");
33:
34: private Scope(int vis, String desc, String decl) {
35: this .vis = vis;
36: this .desc = desc;
37: this .decl = decl;
38: }
39:
40: public boolean isMoreVisibleThan(Scope v) {
41: return this .vis > v.vis;
42: }
43:
44: public boolean isLessVisibleThan(Scope v) {
45: return this .vis < v.vis;
46: }
47:
48: public String getDesc() {
49: return desc;
50: }
51:
52: /** the Java visibility modifier. **/
53: public String getDecl() {
54: return decl;
55: }
56: }
|