久久久久久久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)部是如何工作的?的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

                問(wèn)題描述

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

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

                我知道如何在 java 中使用 java.lang.annotation 庫(kù)創(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.

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

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

                推薦答案

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

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

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

                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)于編寫(xiě)注釋處理器的教程;這是一個(gè)有用的.查看 Processor<上的方法/code> 接口 用于編譯器如何調(diào)用注解處理器;主要操作發(fā)生在 process 方法中,每次編譯器看到具有匹配注解的元素時(shí)都會(huì)調(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)部是如何工作的?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                相關(guān)文檔推薦

                quot;Char cannot be dereferencedquot; error(“Char 不能被取消引用錯(cuò)誤)
                Java Switch Statement - Is quot;orquot;/quot;andquot; possible?(Java Switch 語(yǔ)句 - 是“或/“和可能的?)
                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ù)的三元表達(dá)式的類(lèi)型是什么?)
                Read a text file and store every single character occurrence(讀取文本文件并存儲(chǔ)出現(xiàn)的每個(gè)字符)
                Why do I need to explicitly cast char primitives on byte and short?(為什么我需要在 byte 和 short 上顯式轉(zhuǎn)換 char 原語(yǔ)?)
                  <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一区 | 国产精品国产精品国产专区不片 | 久久青| 五月婷婷丁香 | 亚洲精品视频三区 | 成人免费视频 | 精品毛片| 深夜福利影院 | 日韩三级在线 | 亚洲中字在线 | 午夜激情影院 | 一区二区日韩 | 久久国品片| 国产欧美精品一区 | 最近日韩中文字幕 | 久久久久久久久久一区二区 | 不卡视频一区二区三区 | 国产精品美女久久久 | 国产成人一区二区三区精 | 久久久久一区 | 久久国产精品一区二区三区 | 91亚洲精品久久久电影 | 成人精品免费视频 | 天天草天天操 | 精品一区二区三区中文字幕 | 成人欧美一区二区三区1314 | 盗摄精品av一区二区三区 | 日韩一区二区三区在线播放 | 亚洲一区电影 | 91爱爱·com| 日本黄色片免费在线观看 | 日本中文在线视频 | 精品国产高清一区二区三区 | 成人午夜在线 | 亚洲视频一区在线观看 | 涩涩视频在线观看 |