zoukankan      html  css  js  c++  java
  • Annotation

    1. Annotation类的定义方式:public @interface MyAnnotation {
    2. retention 分:SOURCE,CLASS,RUNTIME
    3. annotation type分:TYPE,FIELD,METHOD,PARAMETER,CONSTRUCTOR,LOCAL_VARIABLE,ANNOTATION_TYPE,PACKAGE
    • annotation type:type

      type是加在类上面的注释:

         用的时候,直接在class上面注释就行了:注释是以annotation对象的形式存在的

    获取注释对应属性值的方法:

    ans的长度是2

    •  获取注释属性值

    不用new bird  这样就可以了:MyAnnotation bb=Bird.class.getAnnotation(MyAnnotation.class);:

    • 获取属性值方法二

    • 如果是annotation type 是method ,那么获取有注解的方法:

    七月又过了三分之二卧槽,睡觉了

  • 相关阅读:
    2014第16周六
    2014第16周五
    2014第16周四
    2014第16周三CSS布局再学习摘录
    2014第16周二
    2014第16周一
    2014第15周日
    2014第15周六
    2014第15周五
    SDN:软件定义网络
  • 原文地址:https://www.cnblogs.com/shilimaixiang/p/11223451.html
Copyright © 2011-2022 走看看