KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > polyglot > types > NoMemberException


1 package polyglot.types;
2
3 import polyglot.util.Position;
4
5 /**
6  * Signals an error in the class resolver system. This exception is thrown
7  * when a <code>ClassResolver</code> is unable to resolve a given class name.
8  */

9 public class NoMemberException extends SemanticException {
10     private int kind;
11     public static final int METHOD = 1;
12     public static final int CONSTRUCTOR = 2;
13     public static final int FIELD = 3;
14     
15     public NoMemberException(int kind, String JavaDoc s) {
16         super(s);
17         this.kind = kind;
18     }
19     
20     public NoMemberException(int kind, String JavaDoc s, Position position) {
21         super(s, position);
22         this.kind = kind;
23     }
24     
25     public int getKind() {
26         return kind;
27     }
28     public String JavaDoc getKindStr() {
29         switch (kind) {
30             case METHOD:
31                 return "method";
32             case CONSTRUCTOR:
33                 return "constructor";
34             case FIELD:
35                 return "field";
36             default:
37                 return "unknown!!!";
38         }
39     }
40 }
41
Popular Tags