JavaTM 2 Platform
Standard Ed. 6

javax.lang.model.element
枚举 ElementKind

java.lang.Object
  继承者 java.lang.Enum<ElementKind>
      继承者 javax.lang.model.element.ElementKind
所有已实现的接口:
Serializable, Comparable<ElementKind>

public enum ElementKind
extends Enum<ElementKind>

元素的 kind

注意,以后可能会添加一些新的元素种类,以适应添加到 Java™ 编程语言未来版本中的新(当前未知的)语言结构。

从以下版本开始:
1.6
另请参见:
Element

枚举常量摘要
ANNOTATION_TYPE
          一个注释类型。
CLASS
          没有用更特殊的种类(如 ENUM)描述的类。
CONSTRUCTOR
          一个构造方法。
ENUM
          一个枚举类型。
ENUM_CONSTANT
          一个枚举常量。
EXCEPTION_PARAMETER
          异常处理程序的参数。
FIELD
          没有用更特殊的种类(如 ENUM_CONSTANT)描述的字段。
INSTANCE_INIT
          一个常量初始化程序。
INTERFACE
          没有用更特殊的种类(如 ANNOTATION_TYPE)描述的接口。
LOCAL_VARIABLE
          局部变量。
METHOD
          一个方法。
OTHER
          一个为实现保留的元素。
PACKAGE
          一个包。
PARAMETER
          方法或构造方法的参数。
STATIC_INIT
          一个静态初始化程序。
TYPE_PARAMETER
          一个类型参数。
 
方法摘要
 boolean isClass()
          如果此元素是以下种类的类,则返回 trueCLASSENUM
 boolean isField()
          如果此元素是以下种类的字段,则返回 trueFIELDENUM_CONSTANT
 boolean isInterface()
          如果此元素是以下种类的接口,则返回 trueINTERFACEANNOTATION_TYPE
static ElementKind valueOf(String name)
          返回带有指定名称的该类型的枚举常量。
static ElementKind[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
从类 java.lang.Enum 继承的方法
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
从类 java.lang.Object 继承的方法
getClass, notify, notifyAll, wait, wait, wait
 

枚举常量详细信息

PACKAGE

public static final ElementKind PACKAGE
一个包。


ENUM

public static final ElementKind ENUM
一个枚举类型。


CLASS

public static final ElementKind CLASS
没有用更特殊的种类(如 ENUM)描述的类。


ANNOTATION_TYPE

public static final ElementKind ANNOTATION_TYPE
一个注释类型。


INTERFACE

public static final ElementKind INTERFACE
没有用更特殊的种类(如 ANNOTATION_TYPE)描述的接口。


ENUM_CONSTANT

public static final ElementKind ENUM_CONSTANT
一个枚举常量。


FIELD

public static final ElementKind FIELD
没有用更特殊的种类(如 ENUM_CONSTANT)描述的字段。


PARAMETER

public static final ElementKind PARAMETER
方法或构造方法的参数。


LOCAL_VARIABLE

public static final ElementKind LOCAL_VARIABLE
局部变量。


EXCEPTION_PARAMETER

public static final ElementKind EXCEPTION_PARAMETER
异常处理程序的参数。


METHOD

public static final ElementKind METHOD
一个方法。


CONSTRUCTOR

public static final ElementKind CONSTRUCTOR
一个构造方法。


STATIC_INIT

public static final ElementKind STATIC_INIT
一个静态初始化程序。


INSTANCE_INIT

public static final ElementKind INSTANCE_INIT
一个常量初始化程序。


TYPE_PARAMETER

public static final ElementKind TYPE_PARAMETER
一个类型参数。


OTHER

public static final ElementKind OTHER
一个为实现保留的元素。此元素不能是正在查找的元素。

方法详细信息

values

public static final ElementKind[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for(ElementKind c : ElementKind.values())
        System.out.println(c);

返回:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static ElementKind valueOf(String name)
返回带有指定名称的该类型的枚举常量。 字符串必须与用于声明该类型的枚举常量的 标识符完全匹配。(不允许有多余 的空格。)

参数:
指定要返回的枚举常量的名称。 -
返回:
返回带有指定名称的枚举常量
抛出:
如果该枚举类型没有带有指定名称的常量, - 则抛出 IllegalArgumentException

isClass

public boolean isClass()
如果此元素是以下种类的类,则返回 trueCLASSENUM

返回:
如果此元素是某种类,则返回 true

isInterface

public boolean isInterface()
如果此元素是以下种类的接口,则返回 trueINTERFACEANNOTATION_TYPE

返回:
如果此元素是某种接口,则返回 true

isField

public boolean isField()
如果此元素是以下种类的字段,则返回 trueFIELDENUM_CONSTANT

返回:
如果此元素是某种字段,则返回 true

JavaTM 2 Platform
Standard Ed. 6

提交错误或意见
有关更多的 API 参考资料和开发人员文档,请参阅 Java 2 SDK SE 开发人员文档。该文档包含更详细的、面向开发人员的描述,以及总体概述、术语定义、使用技巧和工作代码示例。

版权所有 2004 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策