KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > lang > model > element > ElementKind


1 /*
2  * @(#)ElementKind.java 1.4 06/08/02
3  *
4  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package javax.lang.model.element;
9
10 /**
11  * The {@code kind} of an element.
12  *
13  * <p>Note that it is possible additional element kinds will be added
14  * to accommodate new, currently unknown, language structures added to
15  * future versions of the Java&trade; programming language.
16  *
17  * @author Joseph D. Darcy
18  * @author Scott Seligman
19  * @author Peter von der Ah&eacute;
20  * @version 1.4 06/08/02
21  * @see Element
22  * @since 1.6
23  */

24 public enum ElementKind {
25
26     /** A package. */
27     PACKAGE,
28
29     // Declared types
30
/** An enum type. */
31     ENUM,
32     /** A class not described by a more specific kind (like {@code ENUM}). */
33     CLASS,
34     /** An annotation type. */
35     ANNOTATION_TYPE,
36     /**
37      * An interface not described by a more specific kind (like
38      * {@code ANNOTATION_TYPE}).
39      */

40     INTERFACE,
41
42     // Variables
43
/** An enum constant. */
44     ENUM_CONSTANT,
45     /**
46      * A field not described by a more specific kind (like
47      * {@code ENUM_CONSTANT}).
48      */

49     FIELD,
50     /** A parameter of a method or constructor. */
51     PARAMETER,
52     /** A local variable. */
53     LOCAL_VARIABLE,
54     /** A parameter of an exception handler. */
55     EXCEPTION_PARAMETER,
56
57     // Executables
58
/** A method. */
59     METHOD,
60     /** A constructor. */
61     CONSTRUCTOR,
62     /** A static initializer. */
63     STATIC_INIT,
64     /** An instance initializer. */
65     INSTANCE_INIT,
66
67     /** A type parameter. */
68     TYPE_PARAMETER,
69
70     /**
71      * An implementation-reserved element. This is not the element
72      * you are looking for.
73      */

74     OTHER;
75
76
77     /**
78      * Returns {@code true} if this is a kind of class:
79      * either {@code CLASS} or {@code ENUM}.
80      *
81      * @return {@code true} if this is a kind of class
82      */

83     public boolean isClass() {
84     return this == CLASS || this == ENUM;
85     }
86
87     /**
88      * Returns {@code true} if this is a kind of interface:
89      * either {@code INTERFACE} or {@code ANNOTATION_TYPE}.
90      *
91      * @return {@code true} if this is a kind of interface
92      */

93     public boolean isInterface() {
94     return this == INTERFACE || this == ANNOTATION_TYPE;
95     }
96
97     /**
98      * Returns {@code true} if this is a kind of field:
99      * either {@code FIELD} or {@code ENUM_CONSTANT}.
100      *
101      * @return {@code true} if this is a kind of field
102      */

103     public boolean isField() {
104     return this == FIELD || this == ENUM_CONSTANT;
105     }
106 }
107
Popular Tags