久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<legend id='WYSqk'><style id='WYSqk'><dir id='WYSqk'><q id='WYSqk'></q></dir></style></legend>

    • <bdo id='WYSqk'></bdo><ul id='WYSqk'></ul>
  1. <tfoot id='WYSqk'></tfoot>
    <i id='WYSqk'><tr id='WYSqk'><dt id='WYSqk'><q id='WYSqk'><span id='WYSqk'><b id='WYSqk'><form id='WYSqk'><ins id='WYSqk'></ins><ul id='WYSqk'></ul><sub id='WYSqk'></sub></form><legend id='WYSqk'></legend><bdo id='WYSqk'><pre id='WYSqk'><center id='WYSqk'></center></pre></bdo></b><th id='WYSqk'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='WYSqk'><tfoot id='WYSqk'></tfoot><dl id='WYSqk'><fieldset id='WYSqk'></fieldset></dl></div>

    <small id='WYSqk'></small><noframes id='WYSqk'>

      像 @Override 這樣的注解在 Java 內(nèi)部是如何工作的

      How do annotations like @Override work internally in Java?(像 @Override 這樣的注解在 Java 內(nèi)部是如何工作的?)
      <i id='X1BI5'><tr id='X1BI5'><dt id='X1BI5'><q id='X1BI5'><span id='X1BI5'><b id='X1BI5'><form id='X1BI5'><ins id='X1BI5'></ins><ul id='X1BI5'></ul><sub id='X1BI5'></sub></form><legend id='X1BI5'></legend><bdo id='X1BI5'><pre id='X1BI5'><center id='X1BI5'></center></pre></bdo></b><th id='X1BI5'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='X1BI5'><tfoot id='X1BI5'></tfoot><dl id='X1BI5'><fieldset id='X1BI5'></fieldset></dl></div>

      1. <legend id='X1BI5'><style id='X1BI5'><dir id='X1BI5'><q id='X1BI5'></q></dir></style></legend>

              <bdo id='X1BI5'></bdo><ul id='X1BI5'></ul>
                <tbody id='X1BI5'></tbody>

              • <tfoot id='X1BI5'></tfoot>
              • <small id='X1BI5'></small><noframes id='X1BI5'>

                本文介紹了像 @Override 這樣的注解在 Java 內(nèi)部是如何工作的?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                問題描述

                誰能向我解釋一下注解在 java 內(nèi)部是如何工作的?

                Can anybody explain to me how annotations work internally in java?

                我知道如何在 java 中使用 java.lang.annotation 庫創(chuàng)建自定義注釋.但我仍然不明白它在內(nèi)部是如何工作的,例如 @Override 注釋.

                I know how we can create custom annotations by using java.lang.annotation library in java. But I still don't get how it's working internally for example, the @Override annotation.

                如果有人能詳細解釋一下,我將非常感激.

                I will be really thankful if anyone could explain that in detail.

                推薦答案

                注解種類的第一個主要區(qū)別是它們是在編譯時使用然后被丟棄(如@Override)還是放置在已編譯的類文件中并在運行時可用(如 Spring 的 @Component).這由 @Retention 決定注釋的策略.如果您正在編寫自己的注解,則需要確定該注解是在運行時有用(可能用于自動配置)還是僅在編譯時有用(用于檢查或代碼生成).

                The first main distinction between kinds of annotation is whether they're used at compile time and then discarded (like @Override) or placed in the compiled class file and available at runtime (like Spring's @Component). This is determined by the @Retention policy of the annotation. If you're writing your own annotation, you'd need to decide whether the annotation is helpful at runtime (for autoconfiguration, perhaps) or only at compile time (for checking or code generation).

                編譯帶有注解的代碼時,編譯器看到注解就像看到源元素上的其他修飾符一樣,例如訪問修飾符 (public/private) 或 最終.當(dāng)它遇到一個注解時,它會運行一個注解處理器,它就像一個插件類,它表示它對特定的注解感興趣.注釋處理器通常使用反射 API 來檢查正在編譯的元素,并且可以簡單地對它們運行檢查、修改它們或生成要編譯的新代碼.@Override 是第一個例子;它使用反射 API 來確保它可以在其中一個超類中找到方法簽名的匹配項,如果不能,則使用 Messager 導(dǎo)致編譯錯誤.

                When compiling code with annotations, the compiler sees the annotation just like it sees other modifiers on source elements, like access modifiers (public/private) or final. When it encounters an annotation, it runs an annotation processor, which is like a plug-in class that says it's interested a specific annotation. The annotation processor generally uses the Reflection API to inspect the elements being compiled and may simply run checks on them, modify them, or generate new code to be compiled. @Override is an example of the first; it uses the Reflection API to make sure it can find a match for the method signature in one of the superclasses and uses the Messager to cause a compile error if it can't.

                有許多關(guān)于編寫注釋處理器的教程;這是一個有用的.查看 Processor<上的方法/code> 接口 用于編譯器如何調(diào)用注解處理器;主要操作發(fā)生在 process 方法中,每次編譯器看到具有匹配注解的元素時都會調(diào)用該方法.

                There are a number of tutorials available on writing annotation processors; here's a useful one. Look through the methods on the Processor interface for how the compiler invokes an annotation processor; the main operation takes place in the process method, which gets called every time the compiler sees an element that has a matching annotation.

                這篇關(guān)于像 @Override 這樣的注解在 Java 內(nèi)部是如何工作的?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

                相關(guān)文檔推薦

                quot;Char cannot be dereferencedquot; error(“Char 不能被取消引用錯誤)
                Java Switch Statement - Is quot;orquot;/quot;andquot; possible?(Java Switch 語句 - 是“或/“和可能的?)
                Java Replace Character At Specific Position Of String?(Java替換字符串特定位置的字符?)
                What is the type of a ternary expression with int and char operands?(具有 int 和 char 操作數(shù)的三元表達式的類型是什么?)
                Read a text file and store every single character occurrence(讀取文本文件并存儲出現(xiàn)的每個字符)
                Why do I need to explicitly cast char primitives on byte and short?(為什么我需要在 byte 和 short 上顯式轉(zhuǎn)換 char 原語?)
                  <tfoot id='0TTAz'></tfoot>

                        • <bdo id='0TTAz'></bdo><ul id='0TTAz'></ul>
                          <legend id='0TTAz'><style id='0TTAz'><dir id='0TTAz'><q id='0TTAz'></q></dir></style></legend>
                            <tbody id='0TTAz'></tbody>
                        • <i id='0TTAz'><tr id='0TTAz'><dt id='0TTAz'><q id='0TTAz'><span id='0TTAz'><b id='0TTAz'><form id='0TTAz'><ins id='0TTAz'></ins><ul id='0TTAz'></ul><sub id='0TTAz'></sub></form><legend id='0TTAz'></legend><bdo id='0TTAz'><pre id='0TTAz'><center id='0TTAz'></center></pre></bdo></b><th id='0TTAz'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='0TTAz'><tfoot id='0TTAz'></tfoot><dl id='0TTAz'><fieldset id='0TTAz'></fieldset></dl></div>

                          <small id='0TTAz'></small><noframes id='0TTAz'>

                          主站蜘蛛池模板: 日韩成人在线视频 | 日韩视频在线播放 | 污污的网站在线观看 | 剑来高清在线观看 | 久久国产精品免费视频 | 久久精品国产亚洲 | av中文字幕网 | 久久精品视频在线观看 | www久久 | 欧美精品一区二区三区在线播放 | a久久| 日韩精品在线一区二区 | 亚洲精品在线观 | 欧美亚洲国产日韩 | 久久国产精品99久久久大便 | 精精国产xxxx视频在线播放 | 在线观看亚洲专区 | 在线一区二区三区 | 一级a性色生活片久久毛片波多野 | 成人综合视频在线观看 | 国产一区不卡在线观看 | 一区二区精品视频 | 欧美jizzhd精品欧美巨大免费 | 国产成人jvid在线播放 | 精品视频一区二区 | 伊人精品久久久久77777 | 国产人成精品一区二区三 | 欧美成人h版在线观看 | 国产精品国产成人国产三级 | 国产成人jvid在线播放 | 亚洲国产精品日韩av不卡在线 | 亚洲视频免费在线观看 | 日韩中文字幕在线观看 | 国产精品久久久久久久久久妞妞 | www成人免费视频 | 国产精品美女久久久久aⅴ国产馆 | 欧美久久久久久 | 一区二区三区影院 | 亚洲国产精品成人久久久 | 久久精彩视频 | 国产美女一区二区 |