【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 ...
随机推荐
- MacOS install configure php-fpm
php-fpm 是预装在mac os上的,你只需要配置就好了.这个服务监听9000端口. 1. 为配置文件准备一些目录 mkdir -p /usr/share/php/var/run mkdir -p ...
- C# 反射(Reflection)
什么是反射 发射是 .net framework 提供的一个帮助类库,用于读取和使用元数据. 用到的类:System.Reflection,System.Type.System.Type 类对于反射起 ...
- super()方法
super()是一个调用父类的方法. super()用来解决多继承问题,直接用类名调用父类的方法在单继承中是没有问题的,但是如果使用多继承会涉及到查找顺序(MRO).重复调用等种种问题. python ...
- rsync 常用参数
rsync 常用参数的具体解释如下: -v, --verbose 详细模式输出-q, --quiet 精简输出模式-c, --checksum 打开校验开关,强制对文件传输进行校验-a, --arch ...
- Java 文件读写操作
1[1]按字节读写,一次只读取一个字节,效率比较低 package bk1; import java.io.File; import java.io.FileInputStream; import j ...
- bochs
● 制作一个硬盘 ./bximage 步骤与制作软盘的相似,完成后将bochs软件提示的最后一句话,添加到自己的配置文件里: dd if=loader.bin of=~/Softwares/bochs ...
- SPOJ - TSUM 母函数+FFT+容斥
题意:n个数,任取三个加起来,问每个可能的结果的方案数. 题解:构造母函数ABC,比如现在有 1 2 3 三个数.则 其中B表示同一个数加两次,C表示用三次.然后考虑去重. A^3表示可重复地拿三个. ...
- Server:www121 Server:www120 Server:NWS_SP
Request URL:http://www.biyao.com/minisite/bzzx Request Method:GET Status Code:200 OK Remote Address: ...
- Laravel 5.2 INSTALL- node's npm and ruby's bundler.
https://getcomposer.org/doc/00-intro.md Introduction# Composer is a tool for dependency management i ...
- Chap5:操作文件和目录[The Linux Command Line]
Wildcards Wildcard Meaning * Matches any characters ? Matches any single character [characters] Matc ...