獲取javaBean所有屬性及類(lèi)型_第1頁(yè)
獲取javaBean所有屬性及類(lèi)型_第2頁(yè)
獲取javaBean所有屬性及類(lèi)型_第3頁(yè)
全文預(yù)覽已結(jié)束

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、獲得javaBean的所有屬性及類(lèi)型一、程序功能定義a) 獲得javabean所有屬性及類(lèi)型b) 僅僅是獲得,賦值還沒(méi)想到怎么弄。二、目的a) 參考方法b) 目前還不知道有什么用。c) 本來(lái)想給javaBean 一次性賦值的,但是貌似吧得用反射才行,而反射挺費(fèi)資源的, 那只好暫時(shí)擱一擱了。三、程序代碼四、代碼中公用到兩個(gè)類(lèi)a) getBea ns.java 與 pers on Bea n.java getBea ns.javaimportjava.bea ns.Bea nlnfo;importjava.bea ns.ln trospect ion Exceptio n;importjava.b

2、ea ns.ln trospector;import java.bea ns.PropertyDescriptor;public classgetBea ns * param args*/public static void main( Stri ng args) /TODO Auto-ge nerated method stubpers on Bea n pb=new pers on Bea n();PropertyDescriptorpr= getPropertyDescriptors(pb.getClass();"="+pri.getPropertyType()for

3、 ( int i=1;i<pr.length;i+)System. out .println(pri.getName()+ );publicstaticPropertyDescriptorgetPropertyDescriptors(Classclazz) Bea nlnfo bea nlnfo =n ull ;try (clazz);bea nlnfo = In trospector.getBea nlnfo catch(In trospecti on Excepti on e) e.pri ntStackTrace();return bea nln fo.getPropertyDes

4、criptors();pers on Bea n.javapublic classperson Bean int id =0;Stri ngn ame = "pheygir"int she ngao =180; booleanmale =true ;public int getld() return id ;public void setld( int id) this . id = id;public String getName() retur n n ame;public void setName(Stri ng n ame) this . name = name;p

5、ublic int getShe ngao() returnshengao ;public void setShe ngao( int she ngao) this . shengao = shengao;publicboolea nisMale() return male ;public void setMale( boolea n male) this . male = male;僅供參考,還不知道有沒(méi)有用。When you are old and grey and full of sleep,And no ddi ng by the fire, take down this book,A

6、nd slowly read, and dream of the soft lookYour eyes had once, and of their shadows deep;How many loved your mome nts of glad grace,And loved your beauty with love false or true,But one man loved the pilgrim soul in you,And loved the sorrows of your cha nging face;And bending dow n beside the glow in

7、g bars,Murmur, a little sadly, how love fledAnd paced upon the mountains overheadAnd hid his face amid a crowd of stars.The furthest dista nee in the worldIs not betwee n life and deathBut whe n I sta nd in front of youYet you don't know thatI love you.The furthest dista nee in the worldIs not w

8、he n I sta nd in front of youYet you can't see my loveBut whe n un doubtedly knowing the love from bothYet cannot be together.The furthest dista nee in the worldIs not being apart while being in loveBut whe n I pla inly cannot resist the year ningYet prete nding you have n ever bee n in my heart.The furthest dista nee in the worldIs

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論