Annotation
来源:互联网 发布:写字板软件下载 编辑:程序博客网 时间:2024/04/28 08:05
Annotation 注解
public interfaceAnnotation
a) Annotation是一个接口
b) 所有使用@interface 自定义的注解都继承于java.lang.annotation.Annotation
c) 如果有接口extends Annotation,那么该接口依旧是接口,这和注解没有任何关系
public interface Personextends Annotation 定义接口
public @interface Person 定义注解
public @interface Override
public @interfaceSuppressWarnings
public @interfaceDeprecated
public @interfaceRetention
一个方法可以被多个注解修饰
一个注解也可以被多个注解修饰
Retention 修饰注解 指明注解保持的时间
enum RetentionPolicy
{
SOURCE,CLASS,RUNTIME;
}
SOURCE 注解信息保留在源文件中
CLASS 注解信息保留在class文件中
RUNTIME 注解信息可以保留在VM中,反射读取
public @interfaceRetention
{
[enum 类型]RetentionPolicy value;
}
@Retention(value =RetentionPolicy.SOURCE)
public @interfaceOverride...
@Retention(value =RetentionPolicy.SOURCE)
public @interface SuppressWarnings...
@Retention(value =RetentionPolicy.RUNTIME)
public @interfaceDeprecated...
@Retention(value =RetentionPolicy.RUNTIME)
public @interfaceRetention...
public enumRetentionPolicy ...
- annotation
- Annotation
- Annotation
- Annotation
- Annotation
- Annotation
- Annotation
- Annotation
- annotation
- Annotation
- Annotation
- @Annotation
- Annotation
- Annotation
- Annotation
- Annotation
- Annotation
- Annotation
- IEnumerable
- SPOJ MYQ10 (数位DP)
- 用 Windows Live Writer 写博客配置备忘
- Linux下crontab的使用
- start with
- Annotation
- the c programing language 练习1-17
- C++0X的三件好东西(零)
- 数据泵
- Java笔记七.线程间通信与线程生命的控制
- 快速掌握一个语言最常用的50%
- Nmap 空闲扫描
- oracle基本语法
- poj 3100 && zoj 2818 ( Root of the Problem ) (睡前一水)