JavaAPI之ElementType枚举类
2016-06-05 23:33
447 查看
结构:
java.lang.annotation枚举 ElementType
java.lang.Object java.lang.Enum<ElementType> java.lang.annotation.ElementType
所有已实现的接口: Serializable,Comparable<ElementType>
描述:
public enum ElementTypeextends Enum<ElementType>
程序元素类型。此枚举类型的常量提供了 Java 程序中声明的元素的简单分类。
这些常量与
Target元注释类型一起使用,以指定在什么情况下使用注释类型是合法的。
从以下版本开始: 1.5
枚举常量:
1、public static final ElementTypeTYPE 类、接口(包括注释类型)或枚举声明2、public static final ElementTypeFIELD 字段声明(包括枚举常量)
3、public static final ElementTypeMETHOD 方法声明
4、public static final ElementTypePARAMETER 参数声明
5、public static final ElementTypeCONSTRUCTOR 构造方法声明
6、public static final ElementTypeLOCAL_VARIABLE 局部变量声明
7、public static final ElementTypeANNOTATION_TYPE 注释类型声明
8、public static final ElementTypePACKAGE 包声明
方法详细:
1、public static final ElementType[] 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(ElementType c : ElementType.values()) System.out.println(c);
返回:an array containing the constants of this enum type, in the order they are declared
2、public static ElementTypevalueOf(String name)
返回带有指定名称的该类型的枚举常量。字符串必须与用于声明该类型的枚举常量的标识符完全匹配。(不允许有多余的空格。)
参数:
指定要返回的枚举常量的名称。- 返回:返回带有指定名称的枚举常量 抛出:
如果该枚举类型没有带有指定名称的常量,- 则抛出 IllegalArgumentException
相关文章推荐
- Java Sax解析xml
- 堆排序
- Set、List、Map的总结
- 优先队列
- java基础-filter
- JavaAPI之注释类型Target
- [置顶] 初探JVM的背面JPDA(Java Platform Debugger Architecture)
- Hadoop学习笔记(二)——插件安装和使用(Hadoop Eclipse)
- Java基础之String类型的使用
- 第一个Java web项目
- 分布式锁1 Java常用技术方案
- 快速排序
- java -version 错误
- 设计模式 : 单例设计模式
- SpringMVC-JSON
- springmvc 通过异常增强返回给客户端统一格式
- Ajax常见错误总结
- Ubuntu下配置jdk8
- Java的数据类型和变量
- 20145129 《Java程序设计》项目开发进度