@inte***ce
public @inte***ce testannotation
@testannotation
public class test
@retention(retentionpolicy.runtime)
public @inte***ce testannotation
elementtype.constructor 可以給構造方法進行註解
elementtype.field 可以給屬性進行註解
elementtype.local_variable 可以給區域性變數進行註解
elementtype.method 可以給方法進行註解
elementtype.package 可以給乙個包進行註解
elementtype.parameter 可以給乙個方法內的引數進行註解
elementtype.type 可以給乙個型別進行註解,比如類、介面、列舉
@inherited
@retention(retentionpolicy.runtime)
@inte***ce test {}
@test
public class a {}
public class b extends a {}
@inherited
@retention(retentionpolicy.runtime)
@inte***ce test {}
@test
public inte***ce a {}
public inte***ce b extends a {}
@inte***ce persons
@repeatable(persons.class)
@inte***ce person
@person(role="artist")
@person(role="coder")
@person(role="pm")
public class superman
@inte***ce persons
Java註解教程 學習筆記
一 概述jdk5之後提供了乙個特性,和類 介面同級 註解本質就是乙個介面,介面中可以有常量和抽象方法,抽象方法在註解中就稱之為註解屬性 示例 target elementtype.method retention retentionpolicy.runtime public inte ce acce...
java 註解學習和Spring常用註解學習
18.12.16 註解學習 我的理解 註解就是給編譯器看的注釋,它可以向編譯器 虛擬機器等解釋說明一些問題或一些描述。註解在程式執行時都能起作用,而注釋在編譯時就已經沒用了。形同public static等註解也是一種修飾符,編譯器能夠讀懂它的含義,通過註解解析工具能夠將註解翻譯為模組化的 許多框架...
Java 註解 元註解
retention retentionpolicy.source 註解僅存在於原始碼中,在class位元組碼檔案中不包含 retention retentionpolicy.class 預設的保留策略,註解會在class位元組碼檔案中存在,但執行時無法獲得,retention retentionpo...