您的位置:首页 > 编程语言 > Java开发

Java注解(annotation)概述

2017-12-27 09:30 447 查看
Annotations, a form of metadata, provide data about a program that is not part of the program itself. Annotations have no direct effect on the operation of the code they annotate。

一般来说Annotation有如下三种使用情形:

Information for the compiler — Annotations can be used by the compiler to detect errors or suppress * warnings.**

Compile-time and deployment-time processing — Software tools can process annotation information to generate code, XML files, and so forth.

Runtime processing— Some annotations are available to be examined at runtime.

为编译器提供辅助信息 — Annotations可以为编译器提供而外信息,以便于检测错误,抑制警告等.

编译源代码时进行而外操作 — 软件工具可以通过处理Annotation信息来生成原代码,xml文件等等.

运行时处理 — 有一些annotation甚至可以在程序运行时被检测,使用.



参考资料:

https://www.race604.com/annotation-processing/

http://hannesdorfmann.com/annotation-processing/annotationprocessing101

http://blog.csdn.net/xfxyy_sxfancy/article/details/44275549#t3
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  java 注解 annotation