久久久久久久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 內部是如何工作的

      How do annotations like @Override work internally in Java?(像 @Override 這樣的注解在 Java 內部是如何工作的?)
      <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 內部是如何工作的?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

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

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

                我知道如何在 java 中使用 java.lang.annotation 庫創建自定義注釋.但我仍然不明白它在內部是如何工作的,例如 @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.

                推薦答案

                注解種類的第一個主要區別是它們是在編譯時使用然后被丟棄(如@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) 或 最終.當它遇到一個注解時,它會運行一個注解處理器,它就像一個插件類,它表示它對特定的注解感興趣.注釋處理器通常使用反射 API 來檢查正在編譯的元素,并且可以簡單地對它們運行檢查、修改它們或生成要編譯的新代碼.@Override 是第一個例子;它使用反射 API 來確保它可以在其中一個超類中找到方法簽名的匹配項,如果不能,則使用 Messager 導致編譯錯誤.

                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.

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

                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.

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

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

                相關文檔推薦

                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 操作數的三元表達式的類型是什么?)
                Read a text file and store every single character occurrence(讀取文本文件并存儲出現的每個字符)
                Why do I need to explicitly cast char primitives on byte and short?(為什么我需要在 byte 和 short 上顯式轉換 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'>

                          主站蜘蛛池模板: 视频在线亚洲 | 日韩不卡视频在线观看 | 午夜影院在线免费观看视频 | 99国产精品久久久久久久 | 91网站在线播放 | 国产精品一区二区三区在线 | 免费观看一级特黄欧美大片 | 国产一区三区在线 | 国产精品特级毛片一区二区三区 | 国产精品久久久久久久久 | 久久久一区二区 | 国产在线精品一区二区三区 | 午夜a√ | 国产精品不卡一区 | 女人牲交视频一级毛片 | 美女久久久久久久久 | 三级av在线 | 操操日 | 精品欧美一区二区三区免费观看 | 成人免费看片网 | 欧美综合一区二区 | 国产在线精品一区二区三区 | 国产精品a免费一区久久电影 | av免费在线观看网站 | 久久涩涩 | 国产96在线 | 99视频精品| 久久精品在线免费视频 | 日韩av一区二区在线 | 精品在线一区二区 | 国产视频不卡一区 | h视频在线免费 | 91精品国产乱码久久久 | 国产精品日日做人人爱 | 日韩一区二区三区在线视频 | 国产激情亚洲 | 国产一区二区三区四区五区加勒比 | 日本在线视频一区二区 | 一级毛片免费完整视频 | 亚洲精品久久久 | 成人欧美一区二区三区在线观看 |