-
Notifications
You must be signed in to change notification settings - Fork 43
java Annotations
cheyiliu edited this page Sep 26, 2014
·
6 revisions
- 概念
An annotation is a form of metadata, that can be added to Java source code. Classes, methods, variables,
parameters and packages may be annotated. Annotations have no direct effect on the operation of the code they annotate.
能够添加到 Java 源代码的语法元数据。类、方法、变量、参数、包都可以被注解,可用来将信息元数据与程序元素进行关联。Annotation 中文常译为“注解”
- 作用
- 标记,用于告诉编译器一些信息
- 编译时动态处理,如动态生成代码
- 运行时动态处理,如得到注解信息 这里的三个作用实际对应着后面自定义 Annotation 时说的 @Retention 三种值分别表示的 Annotation
- 标准 Annotation
- 元 Annotation
- 自定义 Annotation
- 运行时 Annotation 解析
- 编译时 Annotation 解析
TODO
Just build something.