zoukankan      html  css  js  c++  java
  • Java custom annotations

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

  • 相关阅读:
    LeetCode 4 :Majority Element
    LeetCode 3 :Min Stack
    Oracle操作4
    plsql安装教程
    java Date与String互相转化
    Oracle操作3
    Oracle操作2
    Oracle操作
    Oracle11g修改密码
    Visual Studio2013完全卸载
  • 原文地址:https://www.cnblogs.com/chayu3/p/3252976.html
Copyright © 2011-2022 走看看