Custom annotation definition is similar as Interface, just with @ in front. Annotation interface itself can have or have not annotations. @Retention(RetentionPolicy.RUNTIME) means VM will retain annotation with this type so they can be read reflectively at run-time.

Java defines a set of annotations that are build into the language:

Annotations applied to Java code: 1, @Override  2, @Deprecated  3, @SuppressWarnings

Annotations applied to other annotations: 1, @Retention(specifies how the marked annotation is stored)   2, @Documented  3, @Target(specifies where this annotation can be applied to)   4, @Inherited

Unlike interface method declarations, custom annotation have method like "int retryCount() default 5;", "default" keyword is only for java annotations. If you want to use another value, when using this custom annotation, @FluentInterface(retryCount=6).

Java custom annotations的更多相关文章

  1. Java 注解(Annotations) 详解

    注解是元数据 注解是一种装饰器.一个标记(maker),应用于Java的各种结构之上,例如类.方法.字段.用来为这些结构绑定元数据.注解不包含任何业务逻辑. 只由运行时框架或编译器根据注解信息去执行具 ...

  2. Java Junit5 Annotations

    @BeforeEach 在方法上注解,在每个测试方法运行之前执行 @AfterEach 在方法上注解,在每个测试方法运行之后执行 @BeforeAll 该注解方法会在所有测试方法之前运行,该方法必须是 ...

  3. How Do Annotations Work in Java?--转

    原文地址:https://dzone.com/articles/how-annotations-work-java Annotations have been a very important par ...

  4. Java Annotations: Explored & Explained--转载

    原文地址:http://www.javacodegeeks.com/2012/08/java-annotations-explored-explained.html One of the many w ...

  5. Java Method Logging with AOP and Annotations

    Sometimes, I want to log (through slf4j and log4j) every execution of a method, seeing what argument ...

  6. Java中的反射和注解

    前言 在Java中,反射机制和注解机制一直是一个很重要的概念,那么他们其中的原理是怎么样呢,我们不仅仅需要会使用,更要知其然而之所以然. 目录 反射机制 反射如何使用 注解定义 注解机制原理 注解如何 ...

  7. 【Java基础】反射和注解

    前言 在Java中,反射机制和注解机制一直是一个很重要的概念,那么他们其中的原理是怎么样呢,我们不仅仅需要会使用,更要知其然而之所以然. 目录 反射机制 反射如何使用 注解定义 注解机制原理 注解如何 ...

  8. Spring Enable annotation – writing a custom Enable annotation

    原文地址:https://www.javacodegeeks.com/2015/04/spring-enable-annotation-writing-a-custom-enable-annotati ...

  9. java自定义注解实现前后台参数校验

    2016.07.26 qq:992591601,欢迎交流 首先介绍些基本概念: Annotations(also known as metadata)provide a formalized way ...

随机推荐

  1. 【MYSQL】在脚本中使用变量-执行脚本时传参

    在shell脚本里可以定义变量,并在执行脚本时任意传参. #!/bin/bashdb_name=$1 #将第一个值赋给db_name变量sql_name=$2 #将第二个值赋给sql_name变量my ...

  2. java对于文件传输时---编码格式的一些设置方法

    - ----转 读文件: BufferedReader 从字符输入流中读取文本,缓冲各个字符,从而提供字符.数组和行的高效读取. 可以指定缓冲区的大小,或者可使用默认的大小.大多数情况下,默认值就足够 ...

  3. hdu 4081 Qin Shi Huang's National Road System (次小生成树)

    Qin Shi Huang's National Road System Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/3 ...

  4. 368. Largest Divisible Subset -- 找出一个数组使得数组内的数能够两两整除

    Given a set of distinct positive integers, find the largest subset such that every pair (Si, Sj) of ...

  5. 超详细的Xcode代码格式化教程,可自定义样式。

    超详细的Xcode代码格式化教程,可自定义样式. 为什么要格式化代码 当团队内有多人开发的时候,每个人写的代码格式都有自己的喜好,也可能会忙着写代码而忽略了格式的问题.在之前,我们可能会写完代码后,再 ...

  6. 20145236 《Java程序设计》实验二实验报告

    北京电子科技学院(BESTI)实验报告 课程:Java程序设计 班级:1452 指导教师:娄嘉鹏 实验日期:2016.04.08 实验名称: Java面向对象程序设计 实验内容: 初步掌握单元测试和T ...

  7. abap注意

    1.建表的时候所有的数据元素的总长度不能超过1024. 2.表的主键修改在se11激活不成功,但是可以在se11保存,然后到se14中激活. 3.SM12解锁,在很多时候,经常出现某个表或者可修改的地 ...

  8. JDE报表开发笔记(Client端导出Excel乱码)

    之前导出Excel时没发生任何问题, Client端PL/SQL字符集为UTF-8 Oracle JDE E910字符集为UTF-8 解决方式:添加指定用户的字符集(上图即为修改后的用户字符集) 角色 ...

  9. 用jquery或js实现三个div自动循环轮播

    //3个div的统一class = 'div' var index =0; //3秒轮播一次 var timer = setInterval(function(){     index = (inde ...

  10. ubuntu14.10设置开机启动服务

    1.比如lampp其他的都类似: 我是这么操作:(屌丝初学者) a.把lampp启动程序放到/etc/bin下面 b.vi /etc/rc.local ,加入lampp start(有了第一步就可以这 ...