KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > clirr > core > spi > Scope


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 &gt; Protected &gt; Package &gt; Private
12  *
13  * @author Simon Kitching
14  */

15 public final class Scope
16 {
17     private int vis;
18     private String JavaDoc desc;
19     private String JavaDoc decl;
20
21     /** Object representing private scoped objects. */
22     public static final Scope PRIVATE = new Scope(0, "private", "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", "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 JavaDoc desc, String JavaDoc 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 JavaDoc getDesc()
51     {
52         return desc;
53     }
54
55     /** the Java visibility modifier. **/
56     public String JavaDoc getDecl()
57     {
58         return decl;
59     }
60 }
61
Popular Tags