【Java】-NO.17.EBook.4.Java.1.014-【疯狂Java讲义第3版 李刚】- Annotation
1.0.0 Summary
Tittle:【Java】-NO.17.EBook.4.Java.1.014-【疯狂Java讲义第3版 李刚】- Annotation
Style:EBook
Series:Java
Since:2017-11-01
End:....
Total Hours:...
Degree Of Diffculty:2
Degree Of Mastery:2
Practical Level:2
Desired Goal:2
Archieve Goal:....
Gerneral Evaluation:...
Writer:kingdelee
Related Links:
http://www.cnblogs.com/kingdelee/
1.java.lang 的 5个Annotation
api :https://docs.oracle.com/javase/9/docs/api/java/lang/package-summary.html
| Annotation Type | Description |
|---|---|
| Deprecated |
A program element annotated
@Deprecated is one that programmers are discouraged from using. |
| FunctionalInterface |
An informative annotation type used to indicate that an interface type declaration is intended to be a functional interface as defined by the Java Language Specification.
|
| Override |
Indicates that a method declaration is intended to override a method declaration in a supertype.
|
| SafeVarargs |
A programmer assertion that the body of the annotated method or constructor does not perform potentially unsafe operations on its varargs parameter.
|
| SuppressWarnings |
Indicates that the named compiler warnings should be suppressed in the annotated element (and in all program elements contained in the annotated element).
|
2.java.lang.annotation 的 6个meta Annotation
https://docs.oracle.com/javase/9/docs/api/java/lang/annotation/package-summary.html
| Annotation Type | Description |
|---|---|
| Documented |
If the annotation
@Documented is present on the declaration of an annotation type A, then any @A annotation on an element is considered part of the element's public contract. |
| Inherited |
Indicates that an annotation type is automatically inherited.
|
| Native |
Indicates that a field defining a constant value may be referenced from native code.
|
| Repeatable |
The annotation type
java.lang.annotation.Repeatable is used to indicate that the annotation type whose declaration it (meta-)annotates is repeatable. |
| Retention |
Indicates how long annotations with the annotated type are to be retained.
|
| Target |
Indicates the contexts in which an annotation type is applicable.
|
2.1 @Retention
当需要使用的注解考虑在运行时可以被程序反射读取,则在该注解上加
@Retention(RetentionPolicy.RUNTIME)
public @interface MyAnnotation{}

2.2 @Target
用于指定注解修饰的作用域
// 我定义的注解只能修饰成员变量
@Target(ElementType.FIELD)
public @interface MyAnnotation{}

2.3 @Document
指定可以被提取出文档,一般需要出现在文档的都是必写。

2.4 @Inherited
类B继承类A,类A使用@Inherited时,类B同样继承了类A的@Inherited特性
2.5 @Repeatable
3. 反射获取注解信息

【Java】-NO.17.EBook.4.Java.1.014-【疯狂Java讲义第3版 李刚】- Annotation的更多相关文章
- 【Java】-NO.16.EBook.4.Java.1.007-【疯狂Java讲义第3版 李刚】- Java基础类
1.0.0 Summary Tittle:[Java]-NO.16.EBook.4.Java.1.007-[疯狂Java讲义第3版 李刚]- Java基础类 Style:EBook Series:J ...
- 【Java】-NO.16.EBook.4.Java.1.008-【疯狂Java讲义第3版 李刚】- 集合/容器
1.0.0 Summary Tittle:[Java]-NO.16.EBook.4.Java.1.008-[疯狂Java讲义第3版 李刚]- 集合 Style:EBook Series:Java Si ...
- 【Java】-NO.16.EBook.4.Java.1.011-【疯狂Java讲义第3版 李刚】- AWT
1.0.0 Summary Tittle:[Java]-NO.16.EBook.4.Java.1.011-[疯狂Java讲义第3版 李刚]- AWT Style:EBook Series:Java ...
- 【Java】-NO.16.EBook.4.Java.1.012-【疯狂Java讲义第3版 李刚】- Swing
1.0.0 Summary Tittle:[Java]-NO.16.EBook.4.Java.1.011-[疯狂Java讲义第3版 李刚]- Swing Style:EBook Series:Jav ...
- 【Java】-NO.16.EBook.4.Java.1.012-【疯狂Java讲义第3版 李刚】- JDBC
1.0.0 Summary Tittle:[Java]-NO.16.EBook.4.Java.1.012-[疯狂Java讲义第3版 李刚]- JDBC Style:EBook Series:Java ...
- 【Java】-NO.16.EBook.4.Java.1.005-【疯狂Java讲义第3版 李刚】- 枚举
1.0.0 Summary Tittle:[Java]-NO.16.EBook.4.Java.1.005-[疯狂Java讲义第3版 李刚]- 枚举 Style:EBook Series:Java Si ...
- 【Java】-NO.16.EBook.4.Java.1.006-【疯狂Java讲义第3版 李刚】- 垃圾回收
1.0.0 Summary Tittle:[Java]-NO.16.EBook.4.Java.1.006-[疯狂Java讲义第3版 李刚]- 垃圾回收 Style:EBook Series:Java ...
- 【Java】-NO.16.EBook.4.Java.1.009-【疯狂Java讲义第3版 李刚】- 泛型
1.0.0 Summary Tittle:[Java]-NO.16.EBook.4.Java.1.009-[疯狂Java讲义第3版 李刚]- 泛型 Style:EBook Series:Java Si ...
- 【Java】-NO.16.EBook.4.Java.1.010-【疯狂Java讲义第3版 李刚】- 异常
1.0.0 Summary Tittle:[Java]-NO.16.EBook.4.Java.1.010-[疯狂Java讲义第3版 李刚]- 异常 Style:EBook Series:Java Si ...
随机推荐
- 第9天 py就业班基础02.01-02
明天该看就业班的02 03字串符 2018-4-21 10:47:34 数据类型 py自动给数据分类型 2018-4-21 10:55:05 input使用 定义一个变量 然后input输给变 ...
- 错误票据|2013年蓝桥杯B组题解析第七题-fishers
错误票据 某涉密单位下发了某种票据,并要在年终全部收回. 因为工作人员疏忽,在录入ID号的时候发生了一处错误,造成了某个ID断号,另外一个ID重号. 你的任务是通过编程,找出断号的ID和重号的ID. ...
- /usr/bin/ld: 找不到 -lmsc----解决方案
系统的默认搜索依赖库路径为,/usr/local/lib 在camkelists.txt文件中对可执行文件链接libmsc.so add_executable(iat_publish src/iat_ ...
- plsql developer 安装
PLSQL Developer 安装分以下几步: 一.下载Oracle客户端 PLSQL Developer是通过oracle client连上Oracle server的. http://www.o ...
- class="no-js"
这是什么意思?看了外网的解释,比较明白了.(When Modernizr runs, it removes the "no-js" class and replaces it wi ...
- Spark安装部署(local和standalone模式)
Spark运行的4中模式: Local Standalone Yarn Mesos 一.安装spark前期准备 1.安装java $ sudo tar -zxvf jdk-7u67-linux-x64 ...
- javascript中的数字玩法,颠覆你的眼睛
1.JavaScript中的数字中有一些很奇葩的现象. 在Chrome控制台中可以自己做一下实验: 1 === 1.0 ; //true 习惯了强类型语言,如java,c,OC看到这个结论还是有点小迷 ...
- A crawler that sent a DELETE request to every resource it encountered
RESTful Web APIs_2013 The crawler simulates a very curious but not very picky human. Give it a URL t ...
- 读书笔记iOS-Core-Animation-Advanced-Techniques,iOS性能调试工具
调试卡顿,除了使用timer profile,还可以使用 OpenGL ES驱动工具 OpenGL ES Driver工具显示的GPU利用率,打开Color Blended Layers 我们给图片和 ...
- 微博登录报错 sso package orsign error
https://blog.csdn.net/gao_chun/article/details/41344725 (1)检查应用包名签名信息是否完善 如果你的应用只有一个包名.签名,请在 http:// ...