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

Tue, 09 Oct 2012 19:10:00 -0700

author
jjg
date
Tue, 09 Oct 2012 19:10:00 -0700
changeset 1357
c75be5bc5283
parent 798
4868a36f6fd8
child 2525
2eb010b6cb22
permissions
-rw-r--r--

8000663: clean up langtools imports
Reviewed-by: darcy

duke@1 1 /*
ohair@798 2 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. 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
ohair@554 7 * published by the Free Software Foundation. Oracle designates this
duke@1 8 * particular file as subject to the "Classpath" exception as provided
ohair@554 9 * by Oracle 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 *
ohair@554 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@554 22 * or visit www.oracle.com if you need additional information or have any
ohair@554 23 * 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 */
darcy@594 91 OTHER,
darcy@594 92
darcy@594 93 /**
darcy@594 94 * A resource variable.
darcy@594 95 * @since 1.7
darcy@594 96 */
darcy@594 97 RESOURCE_VARIABLE;
duke@1 98
duke@1 99
duke@1 100 /**
duke@1 101 * Returns {@code true} if this is a kind of class:
duke@1 102 * either {@code CLASS} or {@code ENUM}.
duke@1 103 *
duke@1 104 * @return {@code true} if this is a kind of class
duke@1 105 */
duke@1 106 public boolean isClass() {
duke@1 107 return this == CLASS || this == ENUM;
duke@1 108 }
duke@1 109
duke@1 110 /**
duke@1 111 * Returns {@code true} if this is a kind of interface:
duke@1 112 * either {@code INTERFACE} or {@code ANNOTATION_TYPE}.
duke@1 113 *
duke@1 114 * @return {@code true} if this is a kind of interface
duke@1 115 */
duke@1 116 public boolean isInterface() {
duke@1 117 return this == INTERFACE || this == ANNOTATION_TYPE;
duke@1 118 }
duke@1 119
duke@1 120 /**
duke@1 121 * Returns {@code true} if this is a kind of field:
duke@1 122 * either {@code FIELD} or {@code ENUM_CONSTANT}.
duke@1 123 *
duke@1 124 * @return {@code true} if this is a kind of field
duke@1 125 */
duke@1 126 public boolean isField() {
duke@1 127 return this == FIELD || this == ENUM_CONSTANT;
duke@1 128 }
duke@1 129 }

mercurial