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 Types Summary
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 Types Summary
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的更多相关文章

  1. 【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 ...

  2. 【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 ...

  3. 【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 ...

  4. 【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 ...

  5. 【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 ...

  6. 【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 ...

  7. 【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 ...

  8. 【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 ...

  9. 【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 ...

随机推荐

  1. Hadoop学习之pig

    首先明确pig是解决什么问题而出现的,pig是为了简化mapreduce编程而设计的,并且有自己的一套脚本语言.其基本由命令和操作符来定义的,如load,store,它的功能很明确,用来大规模处理数据 ...

  2. Django之Web框架本质及第一个Django实例

    Web框架本质 我们可以这样理解:所有的Web应用本质上就是一个socket服务端,而用户的浏览器就是一个socket客户端. 这样我们就可以自己实现Web框架了. 半成品自定义web框架 impor ...

  3. Spark RDD Transformation 简单用例(三)

    cache和persist 将RDD数据进行存储,persist(newLevel: StorageLevel)设置了存储级别,cache()和persist()是相同的,存储级别为MEMORY_ON ...

  4. [转] - spark推荐 - 从50多分钟到3分钟的优化

    原文地址 从50多分钟到3分钟的优化 某推荐系统需要基于Spark用ALS算法对近一天的数据进行实时训练, 然后进行推荐. 输入的数据有114G, 但训练时间加上预测的时间需要50多分钟, 而业务的要 ...

  5. Linux多进程和多线程的一次gdb调试实例

    转载https://typecodes.com/cseries/multilprocessthreadgdb.html 1 原文整理 默认设置下,在调试多进程程序时gdb只会调试主进程.gdb7以上的 ...

  6. String和datetime在SQL中和在C#中相互转换方法总结

    Custom Date and Time Format Strings   <= https://docs.microsoft.com/en-us/dotnet/standard/base-ty ...

  7. JS 通过字符串取得对应对象

    //对Array的扩展,查找所有满足条件的元素 Array.prototype.findAll = function (match) { var tmp = []; for (var i = 0; i ...

  8. myEclipse异常:Subversion Native Library Not Available

    参考文档:https://blog.csdn.net/zp357252539/article/details/44880319 Subversion Native Library Not Availa ...

  9. Win10正式版U盘安装教程

    1.首先我们需要登陆“微软中国下载中心”,从中下载一款名为“MediaCreationTool”的工具,利用该工具可以制作Win10安装U盘.直接通过以下地址快速进入“Windows下载中心”,根据自 ...

  10. 主从读写分离----mysql-proxy0.8.5安装与配置

    废话不多说,直接开干: 1.安装环境: yum -y install libevent glib2 lua gcc gcc-c++ autoconf mysql-devel libtool pkgco ...