duke@1: /* ohair@554: * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. duke@1: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. duke@1: * duke@1: * This code is free software; you can redistribute it and/or modify it duke@1: * under the terms of the GNU General Public License version 2 only, as ohair@554: * published by the Free Software Foundation. Oracle designates this duke@1: * particular file as subject to the "Classpath" exception as provided ohair@554: * by Oracle in the LICENSE file that accompanied this code. duke@1: * duke@1: * This code is distributed in the hope that it will be useful, but WITHOUT duke@1: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or duke@1: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License duke@1: * version 2 for more details (a copy is included in the LICENSE file that duke@1: * accompanied this code). duke@1: * duke@1: * You should have received a copy of the GNU General Public License version duke@1: * 2 along with this work; if not, write to the Free Software Foundation, duke@1: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. duke@1: * ohair@554: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ohair@554: * or visit www.oracle.com if you need additional information or have any ohair@554: * questions. duke@1: */ duke@1: duke@1: package javax.lang.model.element; duke@1: duke@1: /** duke@1: * The {@code kind} of an element. duke@1: * duke@1: *

Note that it is possible additional element kinds will be added duke@1: * to accommodate new, currently unknown, language structures added to duke@1: * future versions of the Java™ programming language. duke@1: * duke@1: * @author Joseph D. Darcy duke@1: * @author Scott Seligman duke@1: * @author Peter von der Ahé duke@1: * @see Element duke@1: * @since 1.6 duke@1: */ duke@1: public enum ElementKind { duke@1: duke@1: /** A package. */ duke@1: PACKAGE, duke@1: duke@1: // Declared types duke@1: /** An enum type. */ duke@1: ENUM, duke@1: /** A class not described by a more specific kind (like {@code ENUM}). */ duke@1: CLASS, duke@1: /** An annotation type. */ duke@1: ANNOTATION_TYPE, duke@1: /** duke@1: * An interface not described by a more specific kind (like duke@1: * {@code ANNOTATION_TYPE}). duke@1: */ duke@1: INTERFACE, duke@1: duke@1: // Variables duke@1: /** An enum constant. */ duke@1: ENUM_CONSTANT, duke@1: /** duke@1: * A field not described by a more specific kind (like duke@1: * {@code ENUM_CONSTANT}). duke@1: */ duke@1: FIELD, duke@1: /** A parameter of a method or constructor. */ duke@1: PARAMETER, duke@1: /** A local variable. */ duke@1: LOCAL_VARIABLE, duke@1: /** A parameter of an exception handler. */ duke@1: EXCEPTION_PARAMETER, duke@1: duke@1: // Executables duke@1: /** A method. */ duke@1: METHOD, duke@1: /** A constructor. */ duke@1: CONSTRUCTOR, duke@1: /** A static initializer. */ duke@1: STATIC_INIT, duke@1: /** An instance initializer. */ duke@1: INSTANCE_INIT, duke@1: duke@1: /** A type parameter. */ duke@1: TYPE_PARAMETER, duke@1: duke@1: /** duke@1: * An implementation-reserved element. This is not the element duke@1: * you are looking for. duke@1: */ darcy@594: OTHER, darcy@594: darcy@594: /** darcy@594: * A resource variable. darcy@594: * @since 1.7 darcy@594: */ darcy@594: RESOURCE_VARIABLE; duke@1: duke@1: duke@1: /** duke@1: * Returns {@code true} if this is a kind of class: duke@1: * either {@code CLASS} or {@code ENUM}. duke@1: * duke@1: * @return {@code true} if this is a kind of class duke@1: */ duke@1: public boolean isClass() { duke@1: return this == CLASS || this == ENUM; duke@1: } duke@1: duke@1: /** duke@1: * Returns {@code true} if this is a kind of interface: duke@1: * either {@code INTERFACE} or {@code ANNOTATION_TYPE}. duke@1: * duke@1: * @return {@code true} if this is a kind of interface duke@1: */ duke@1: public boolean isInterface() { duke@1: return this == INTERFACE || this == ANNOTATION_TYPE; duke@1: } duke@1: duke@1: /** duke@1: * Returns {@code true} if this is a kind of field: duke@1: * either {@code FIELD} or {@code ENUM_CONSTANT}. duke@1: * duke@1: * @return {@code true} if this is a kind of field duke@1: */ duke@1: public boolean isField() { duke@1: return this == FIELD || this == ENUM_CONSTANT; duke@1: } duke@1: }