src/share/classes/javax/lang/model/element/ElementKind.java

Sat, 01 Dec 2007 00:00:00 +0000

author
duke
date
Sat, 01 Dec 2007 00:00:00 +0000
changeset 1
9a66ca7c79fa
child 554
9d9f26857129
permissions
-rw-r--r--

Initial load

duke@1 1 /*
duke@1 2 * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
duke@1 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@1 4 *
duke@1 5 * This code is free software; you can redistribute it and/or modify it
duke@1 6 * under the terms of the GNU General Public License version 2 only, as
duke@1 7 * published by the Free Software Foundation. Sun designates this
duke@1 8 * particular file as subject to the "Classpath" exception as provided
duke@1 9 * by Sun in the LICENSE file that accompanied this code.
duke@1 10 *
duke@1 11 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@1 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@1 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@1 14 * version 2 for more details (a copy is included in the LICENSE file that
duke@1 15 * accompanied this code).
duke@1 16 *
duke@1 17 * You should have received a copy of the GNU General Public License version
duke@1 18 * 2 along with this work; if not, write to the Free Software Foundation,
duke@1 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@1 20 *
duke@1 21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@1 22 * CA 95054 USA or visit www.sun.com if you need additional information or
duke@1 23 * have any questions.
duke@1 24 */
duke@1 25
duke@1 26 package javax.lang.model.element;
duke@1 27
duke@1 28 /**
duke@1 29 * The {@code kind} of an element.
duke@1 30 *
duke@1 31 * <p>Note that it is possible additional element kinds will be added
duke@1 32 * to accommodate new, currently unknown, language structures added to
duke@1 33 * future versions of the Java&trade; programming language.
duke@1 34 *
duke@1 35 * @author Joseph D. Darcy
duke@1 36 * @author Scott Seligman
duke@1 37 * @author Peter von der Ah&eacute;
duke@1 38 * @see Element
duke@1 39 * @since 1.6
duke@1 40 */
duke@1 41 public enum ElementKind {
duke@1 42
duke@1 43 /** A package. */
duke@1 44 PACKAGE,
duke@1 45
duke@1 46 // Declared types
duke@1 47 /** An enum type. */
duke@1 48 ENUM,
duke@1 49 /** A class not described by a more specific kind (like {@code ENUM}). */
duke@1 50 CLASS,
duke@1 51 /** An annotation type. */
duke@1 52 ANNOTATION_TYPE,
duke@1 53 /**
duke@1 54 * An interface not described by a more specific kind (like
duke@1 55 * {@code ANNOTATION_TYPE}).
duke@1 56 */
duke@1 57 INTERFACE,
duke@1 58
duke@1 59 // Variables
duke@1 60 /** An enum constant. */
duke@1 61 ENUM_CONSTANT,
duke@1 62 /**
duke@1 63 * A field not described by a more specific kind (like
duke@1 64 * {@code ENUM_CONSTANT}).
duke@1 65 */
duke@1 66 FIELD,
duke@1 67 /** A parameter of a method or constructor. */
duke@1 68 PARAMETER,
duke@1 69 /** A local variable. */
duke@1 70 LOCAL_VARIABLE,
duke@1 71 /** A parameter of an exception handler. */
duke@1 72 EXCEPTION_PARAMETER,
duke@1 73
duke@1 74 // Executables
duke@1 75 /** A method. */
duke@1 76 METHOD,
duke@1 77 /** A constructor. */
duke@1 78 CONSTRUCTOR,
duke@1 79 /** A static initializer. */
duke@1 80 STATIC_INIT,
duke@1 81 /** An instance initializer. */
duke@1 82 INSTANCE_INIT,
duke@1 83
duke@1 84 /** A type parameter. */
duke@1 85 TYPE_PARAMETER,
duke@1 86
duke@1 87 /**
duke@1 88 * An implementation-reserved element. This is not the element
duke@1 89 * you are looking for.
duke@1 90 */
duke@1 91 OTHER;
duke@1 92
duke@1 93
duke@1 94 /**
duke@1 95 * Returns {@code true} if this is a kind of class:
duke@1 96 * either {@code CLASS} or {@code ENUM}.
duke@1 97 *
duke@1 98 * @return {@code true} if this is a kind of class
duke@1 99 */
duke@1 100 public boolean isClass() {
duke@1 101 return this == CLASS || this == ENUM;
duke@1 102 }
duke@1 103
duke@1 104 /**
duke@1 105 * Returns {@code true} if this is a kind of interface:
duke@1 106 * either {@code INTERFACE} or {@code ANNOTATION_TYPE}.
duke@1 107 *
duke@1 108 * @return {@code true} if this is a kind of interface
duke@1 109 */
duke@1 110 public boolean isInterface() {
duke@1 111 return this == INTERFACE || this == ANNOTATION_TYPE;
duke@1 112 }
duke@1 113
duke@1 114 /**
duke@1 115 * Returns {@code true} if this is a kind of field:
duke@1 116 * either {@code FIELD} or {@code ENUM_CONSTANT}.
duke@1 117 *
duke@1 118 * @return {@code true} if this is a kind of field
duke@1 119 */
duke@1 120 public boolean isField() {
duke@1 121 return this == FIELD || this == ENUM_CONSTANT;
duke@1 122 }
duke@1 123 }

mercurial