多多色-多人伦交性欧美在线观看-多人伦精品一区二区三区视频-多色视频-免费黄色视屏网站-免费黄色在线

國內(nèi)最全IT社區(qū)平臺 聯(lián)系我們 | 收藏本站
阿里云優(yōu)惠2
您當(dāng)前位置:首頁 > 互聯(lián)網(wǎng) > [置頂] 譯 Programming with typesafe enums and annotations in Java 5

[置頂] 譯 Programming with typesafe enums and annotations in Java 5

來源:程序員人生   發(fā)布時間:2014-12-07 09:40:13 閱讀次數(shù):3523次

原文為:

Java 101: The next generation: The essential Java language features tour, Part 2

   Programming with typesafe enums and annotations in Java 5


Annotations――Java注解

 

你可能會遇到這類需求:通過與元數(shù)據(jù)(描寫其他數(shù)據(jù)的數(shù)據(jù))關(guān)聯(lián)來注解你Java利用程序。1直以來,Java通過transient關(guān)鍵字提供了1種即時注解(ad hoc annotation)機制,這允許你標(biāo)識1個成員變量在序列化進程中應(yīng)當(dāng)被疏忽。但是,直到j(luò)ava5才正式地引入了1種標(biāo)準(zhǔn)方式去注解程序。


Java5平臺提供了下面4種注解機制:

1. 聲明注解類型:@interface;

2. 元注解類型:可以辨認(rèn)利用于注解類型的程序元素和注解的生命周期(注解類型的1個實例)等;

3.通過Java反射API的1種擴大方式來支持注解處理,你可以用來發(fā)現(xiàn)1個程序的運行時注解,并引入1個泛型Annotation處理工具(APT);

4. 標(biāo)準(zhǔn)的注解類型;


我將通過下面的實例解釋如何應(yīng)用這些方式并闡明注解的難點。


Annotations

You’veprobably encountered the need to annotate elements of your Java applicationsbyassociating metadata (data that describes other data) with them.Java has always provided an ad hoc annotation mechanism via the transientreserved word, which lets you annotate fields that are to be excluded duringserialization. But it didn’t offer a standard way to annotate program elementsuntil Java 5.

Java5’s general annotation mechanism consists of four components:

1.An @interface mechanism for declaring annotation types.
2. Meta-annotation types, which you can use to identify the applicationelements to which an annotation type applies; to identify the lifetime of anannotation (an instance of an annotation type); and more.
3. Support for annotation processing via an extension to the Java ReflectionAPI, which you can use to discover a program’s runtime annotations, and theintroduction of a generalized tool for processing annotations.
4. Standard annotation types.

I’ll explain how to use these componentsand point out some of the challenges of annotations in the examples thatfollow.

 



延續(xù)更新中。。。









生活不易,碼農(nóng)辛苦
如果您覺得本網(wǎng)站對您的學(xué)習(xí)有所幫助,可以手機掃描二維碼進行捐贈
程序員人生
------分隔線----------------------------
分享到:
------分隔線----------------------------
關(guān)閉
程序員人生
主站蜘蛛池模板: 国产偷v国产偷v亚洲偷v | 午夜欧美精品久久久久久久 | 一区二区三区四区无限乱码在线观看 | 国产精品久久久精品视频 | 亚洲天堂999 | 一区小说二区另类小说三区图 | 免费亚洲视频在线观看 | 日韩大片免费看 | 一区二区不卡久久精品 | 久久国产视频在线观看 | 在线视频一区二区三区四区 | 国产综合亚洲欧美日韩一区二区 | 高清在线亚洲精品国产二区 | 欧美一区二区三区在线播放 | 鲁啊鲁阿鲁在线视频播放 | 视频一区二区国产无限在线观看 | 啪啪欧美| 精品久久精品久久 | a免费毛片在线播放 | 亚洲一区二区三区四区五区六区 | 欧美精品18videosex性欧 | 欧美日韩高清在线观看 | 国产亚洲精品日韩已满十八 | 欧美日韩久久毛片 | 手机看片午夜 | 欧美特黄a级高清免费看片 欧美特黄一级aa毛片 | 久久久久伊人 | 精品日韩欧美一区二区三区在线播放 | 在线播放亚洲美女视频网站 | 国产亚洲精品一区999 | 欧美日韩一区二区三区视频播 | 免费精品久久久视频 | a丫久久久久久一级毛片 | 美国一区二区三区 | 欧美日韩视频二区三区 | 亚洲a在线播放 | 亚洲国产精品第一区二区 | free性欧美69 | 国内精品视频在线播放一区 | 亚洲欧洲久久精品 | 999毛片免费观看 |