KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > lib > java > parser > SymbolInfo


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 /*
20  * SymbolInfo.java
21  *
22  * Created on April 19, 2004, 2:05 PM
23  */

24
25 package org.netbeans.lib.java.parser;
26
27 /** This class is common ancesor for classes encapsulaion semantic information about
28  * Java elements. It defines constants for Java elements it can contain.
29  * @author Tomas Hurka
30  */

31 public abstract class SymbolInfo {
32
33     public static final int PACKAGE=0;
34     public static final int JAVACLASS=1;
35     public static final int FIELD=2;
36     public static final int METHOD=3;
37     public static final int CONSTRUCTOR=4;
38     public static final int PARAMETER=5;
39     public static final int LOCVAR=6;
40     public static final int TYPEPARAMETER=7;
41
42     /** holds type of Java element. It is one of PACKAGE, JAVACLASS,
43      * FIELD, METHOD, CONSTRUCTOR, PARAMETER, LOCVAR or TYPEPARAMETER
44      */

45     public final int type;
46     
47     public SymbolInfo(int t) {
48         type=t;
49     }
50
51     public String JavaDoc toString() {
52         String JavaDoc cls = this.getClass().getName();
53         int i = cls.lastIndexOf('.');
54         if (i > -1)
55         cls = cls.substring(i+1);
56         switch (type) {
57             case PACKAGE: return cls + ":PACKAGE";
58             case JAVACLASS: return cls + ":JAVACLASS";
59             case FIELD: return cls + ":FIELD";
60             case METHOD: return cls + ":METHOD";
61             case CONSTRUCTOR: return cls + ":CONSTRUCTOR";
62             case PARAMETER: return cls + ":PARAMETER";
63             case LOCVAR: return cls + ":LOCVAR";
64             case TYPEPARAMETER: return cls + ":TYPEPARAMETER";
65             default:
66                 return cls + ":<unknown type>";
67         }
68     }
69 }
70
Popular Tags