提供静态方法访问单例对象中的方法

  1. PropertyUtils 就是此列
  2. /*
  3. *LicensedtotheApacheSoftwareFoundation(ASF)underoneormore
  4. *contributorlicenseagreements.SeetheNOTICEfiledistributedwith
  5. *thisworkforadditionalinformationregardingcopyrightownership.
  6. *TheASFlicensesthisfiletoYouundertheApacheLicense,Version2.0
  7. *(the"License");youmaynotusethisfileexceptincompliancewith
  8. *theLicense.YoumayobtainacopyoftheLicenseat
  9. *
  10. *http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. *Unlessrequiredbyapplicablelaworagreedtoinwriting,software
  13. *distributedundertheLicenseisdistributedonan"ASIS"BASIS,
  14. *WITHOUTWARRANTIESORCONDITIONSOFANYKIND,eitherexpressorimplied.
  15. *SeetheLicenseforthespecificlanguagegoverningpermissionsand
  16. *limitationsundertheLicense.
  17. */
  18. packageorg.apache.commons.beanutils;
  19. importjava.beans.PropertyDescriptor;
  20. importjava.lang.reflect.InvocationTargetException;
  21. importjava.lang.reflect.Method;
  22. importjava.util.Map;
  23. importorg.apache.commons.collections.FastHashMap;
  24. /**
  25. *<p>UtilitymethodsforusingJavaReflectionAPIstofacilitategeneric
  26. *propertygetterandsetteroperationsonJavaobjects.</p>
  27. *
  28. *<p>Theimplementationsforthesemethodsareprovidedby<code>PropertyUtilsBean</code>.
  29. *Formoredetailssee{@linkPropertyUtilsBean}.</p>
  30. *
  31. *@authorCraigR.McClanahan
  32. *@authorRalphSchaer
  33. *@authorChrisAudley
  34. *@authorReyFrancois
  35. *@authorGregorRayman
  36. *@authorJanSorensen
  37. *@authorScottSanders
  38. *@version$Revision:644137$$Date:2008-04-0303:30:23+0100(Thu,03Apr2008)$
  39. *@seePropertyUtilsBean
  40. *@seeorg.apache.commons.beanutils.expression.Resolver
  41. */
  42. publicclass
  43. {
  44. //-----------------------------------------------------ManifestConstants
  45. /**
  46. *Thedelimiterthatpreceedsthezero-relativesubscriptforan
  47. *indexedreference.
  48. *
  49. *@deprecatedThenotationusedforpropertynameexpressionsisnow
  50. *dependantonthe{@linkorg.apache.commons.beanutils.expression.Resolver}
  51. *implementationbeingused.
  52. */
  53. publicstaticfinalcharINDEXED_DELIM='[';
  54. /**
  55. *Thedelimiterthatfollowsthezero-relativesubscriptforan
  56. *indexedreference.
  57. *
  58. *@deprecatedThenotationusedforpropertynameexpressionsisnow
  59. *dependantonthe{@linkorg.apache.commons.beanutils.expression.Resolver}
  60. *implementationbeingused.
  61. */
  62. publicstaticfinalcharINDEXED_DELIM2=']';
  63. /**
  64. *Thedelimiterthatpreceedsthekeyofamappedproperty.
  65. *
  66. *@deprecatedThenotationusedforpropertynameexpressionsisnow
  67. *dependantonthe{@linkorg.apache.commons.beanutils.expression.Resolver}
  68. *implementationbeingused.
  69. */
  70. publicstaticfinalcharMAPPED_DELIM='(';
  71. /**
  72. *Thedelimiterthatfollowsthekeyofamappedproperty.
  73. *
  74. *@deprecatedThenotationusedforpropertynameexpressionsisnow
  75. *dependantonthe{@linkorg.apache.commons.beanutils.expression.Resolver}
  76. *implementationbeingused.
  77. */
  78. publicstaticfinalcharMAPPED_DELIM2=')';
  79. /**
  80. *Thedelimiterthatseparatesthecomponentsofanestedreference.
  81. *
  82. *@deprecatedThenotationusedforpropertynameexpressionsisnow
  83. *dependantonthe{@linkorg.apache.commons.beanutils.expression.Resolver}
  84. *implementationbeingused.
  85. */
  86. publicstaticfinalcharNESTED_DELIM='.';
  87. //-------------------------------------------------------StaticVariables
  88. /**
  89. *Thedebuggingdetaillevelforthiscomponent.
  90. *
  91. *Notethatthisstaticvariablewillhaveunexpectedside-effectsif
  92. *thisclassisdeployedinasharedclassloaderwithinacontainer.
  93. *Howeverasitisactuallycompletelyignoredbythisclassduetoits
  94. *deprecatedstatus,itdoesn'tdoanyactualharm.
  95. *
  96. *@deprecatedThe<code>debug</code>staticpropertyisnolongerused
  97. */
  98. privatestaticintdebug=0;
  99. /**
  100. *The<code>debug</code>staticpropertyisnolongerused
  101. *@returndebugproperty
  102. *@deprecatedThe<code>debug</code>staticpropertyisnolongerused
  103. */
  104. publicstaticintgetDebug(){
  105. return(debug);
  106. }
  107. /**
  108. *The<code>debug</code>staticpropertyisnolongerused
  109. *@paramnewDebugdebugproperty
  110. *@deprecatedThe<code>debug</code>staticpropertyisnolongerused
  111. */
  112. publicstaticvoidsetDebug(intnewDebug){
  113. debug=newDebug;
  114. }
  115. //---------------------------------------------------------PublicMethods
  116. /**
  117. *Clearanycachedpropertydescriptorsinformationforallclasses
  118. *loadedbyanyclassloaders.Thisisusefulincaseswhereclass
  119. *loadersarethrownawaytoimplementclassreloading.
  120. *
  121. *<p>Formoredetailssee<code>PropertyUtilsBean</code>.</p>
  122. *
  123. *@seePropertyUtilsBean#clearDescriptors
  124. */
  125. publicstaticvoidclearDescriptors(){
  126. PropertyUtilsBean.getInstance().clearDescriptors();
  127. }
  128. /**
  129. *<p>Copypropertyvaluesfromthe"origin"beantothe"destination"bean
  130. *forallcaseswherethepropertynamesarethesame(eventhoughthe
  131. *actualgetterandsettermethodsmighthavebeencustomizedvia
  132. *<code>BeanInfo</code>classes).</p>
  133. *
  134. *<p>Formoredetailssee<code>PropertyUtilsBean</code>.</p>
  135. *
  136. *@paramdestDestinationbeanwhosepropertiesaremodified
  137. *@paramorigOriginbeanwhosepropertiesareretrieved
  138. *
  139. *@exceptionIllegalAccessExceptionifthecallerdoesnothave
  140. *accesstothepropertyaccessormethod
  141. *@exceptionIllegalArgumentExceptionifthe<code>dest</code>or
  142. *<code>orig</code>argumentisnull
  143. *@exceptionInvocationTargetExceptionifthepropertyaccessormethod
  144. *throwsanexception
  145. *@exceptionNoSuchMethodExceptionifanaccessormethodforthis
  146. *propetycannotbefound
  147. *@seePropertyUtilsBean#copyProperties
  148. */
  149. publicstaticvoidcopyProperties(Objectdest,Objectorig)
  150. throwsIllegalAccessException,InvocationTargetException,
  151. NoSuchMethodException{
  152. PropertyUtilsBean.getInstance().copyProperties(dest,orig);
  153. }
  154. /**
  155. *<p>Returntheentiresetofpropertiesforwhichthespecifiedbean
  156. *providesareadmethod.</p>
  157. *
  158. *<p>Formoredetailssee<code>PropertyUtilsBean</code>.</p>
  159. *
  160. *@parambeanBeanwhosepropertiesaretobeextracted
  161. *@returnThesetofpropertiesforthebean
  162. *
  163. *@exceptionIllegalAccessExceptionifthecallerdoesnothave
  164. *accesstothepropertyaccessormethod
  165. *@exceptionIllegalArgumentExceptionif<code>bean</code>isnull
  166. *@exceptionInvocationTargetExceptionifthepropertyaccessormethod
  167. *throwsanexception
  168. *@exceptionNoSuchMethodExceptionifanaccessormethodforthis
  169. *propetycannotbefound
  170. *@seePropertyUtilsBean#describe
  171. */
  172. publicstaticMapdescribe(Objectbean)
  173. throwsIllegalAccessException,InvocationTargetException,
  174. NoSuchMethodException{
  175. return(PropertyUtilsBean.getInstance().describe(bean));
  176. }
  177. /**
  178. *<p>Returnthevalueofthespecifiedindexedpropertyofthespecified
  179. *bean,withnotypeconversions.</p>
  180. *
  181. *<p>Formoredetailssee<code>PropertyUtilsBean</code>.</p>
  182. *
  183. *@parambeanBeanwhosepropertyistobeextracted
  184. *@paramname<code>propertyname[index]</code>ofthepropertyvalue
  185. *tobeextracted
  186. *@returntheindexedpropertyvalue
  187. *
  188. *@exceptionIndexOutOfBoundsExceptionifthespecifiedindex
  189. *isoutsidethevalidrangefortheunderlyingproperty
  190. *@exceptionIllegalAccessExceptionifthecallerdoesnothave
  191. *accesstothepropertyaccessormethod
  192. *@exceptionIllegalArgumentExceptionif<code>bean</code>or
  193. *<code>name</code>isnull
  194. *@exceptionInvocationTargetExceptionifthepropertyaccessormethod
  195. *throwsanexception
  196. *@exceptionNoSuchMethodExceptionifanaccessormethodforthis
  197. *propetycannotbefound
  198. *@seePropertyUtilsBean#getIndexedProperty(Object,String)
  199. */
  200. publicstaticObjectgetIndexedProperty(Objectbean,Stringname)
  201. throwsIllegalAccessException,InvocationTargetException,
  202. NoSuchMethodException{
  203. return(PropertyUtilsBean.getInstance().getIndexedProperty(bean,name));
  204. }
  205. /**
  206. *<p>Returnthevalueofthespecifiedindexedpropertyofthespecified
  207. *bean,withnotypeconversions.</p>
  208. *
  209. *<p>Formoredetailssee<code>PropertyUtilsBean</code>.</p>
  210. *
  211. *@parambeanBeanwhosepropertyistobeextracted
  212. *@paramnameSimplepropertynameofthepropertyvaluetobeextracted
  213. *@paramindexIndexofthepropertyvaluetobeextracted
  214. *@returntheindexedpropertyvalue
  215. *
  216. *@exceptionIndexOutOfBoundsExceptionifthespecifiedindex
  217. *isoutsidethevalidrangefortheunderlyingproperty
  218. *@exceptionIllegalAccessExceptionifthecallerdoesnothave
  219. *accesstothepropertyaccessormethod
  220. *@exceptionIllegalArgumentExceptionif<code>bean</code>or
  221. *<code>name</code>isnull
  222. *@exceptionInvocationTargetExceptionifthepropertyaccessormethod
  223. *throwsanexception
  224. *@exceptionNoSuchMethodExceptionifanaccessormethodforthis
  225. *propetycannotbefound
  226. *@seePropertyUtilsBean#getIndexedProperty(Object,String,int)
  227. */
  228. publicstaticObjectgetIndexedProperty(Objectbean,
  229. Stringname,intindex)
  230. throwsIllegalAccessException,InvocationTargetException,
  231. NoSuchMethodException{
  232. return(PropertyUtilsBean.getInstance().getIndexedProperty(bean,name,index));
  233. }
  234. /**
  235. *<p>Returnthevalueofthespecifiedmappedpropertyofthe
  236. *specifiedbean,withnotypeconversions.</p>
  237. *
  238. *<p>Formoredetailssee<code>PropertyUtilsBean</code>.</p>
  239. *
  240. *@parambeanBeanwhosepropertyistobeextracted
  241. *@paramname<code>propertyname(key)</code>ofthepropertyvalue
  242. *tobeextracted
  243. *@returnthemappedpropertyvalue
  244. *
  245. *@exceptionIllegalAccessExceptionifthecallerdoesnothave
  246. *accesstothepropertyaccessormethod
  247. *@exceptionInvocationTargetExceptionifthepropertyaccessormethod
  248. *throwsanexception
  249. *@exceptionNoSuchMethodExceptionifanaccessormethodforthis
  250. *propetycannotbefound
  251. *@seePropertyUtilsBean#getMappedProperty(Object,String)
  252. */
  253. publicstaticObjectgetMappedProperty(Objectbean,Stringname)
  254. throwsIllegalAccessException,InvocationTargetException,
  255. NoSuchMethodException{
  256. return(PropertyUtilsBean.getInstance().getMappedProperty(bean,name));
  257. }
  258. /**
  259. *<p>Returnthevalueofthespecifiedmappedpropertyofthespecified
  260. *bean,withnotypeconversions.</p>
  261. *
  262. *<p>Formoredetailssee<code>PropertyUtilsBean</code>.</p>
  263. *
  264. *@parambeanBeanwhosepropertyistobeextracted
  265. *@paramnameMappedpropertynameofthepropertyvaluetobeextracted
  266. *@paramkeyKeyofthepropertyvaluetobeextracted
  267. *@returnthemappedpropertyvalue
  268. *
  269. *@exceptionIllegalAccessExceptionifthecallerdoesnothave
  270. *accesstothepropertyaccessormethod
  271. *@exceptionInvocationTargetExceptionifthepropertyaccessormethod
  272. *throwsanexception
  273. *@exceptionNoSuchMethodExceptionifanaccessormethodforthis
  274. *propetycannotbefound
  275. *@seePropertyUtilsBean#getMappedProperty(Object,String,String)
  276. */
  277. publicstaticObjectgetMappedProperty(Objectbean,
  278. Stringname,Stringkey)
  279. throwsIllegalAccessException,InvocationTargetException,
  280. NoSuchMethodException{
  281. returnPropertyUtilsBean.getInstance().getMappedProperty(bean,name,key);
  282. }
  283. /**
  284. *<p>Returnthemappedpropertydescriptorsforthisbeanclass.</p>
  285. *
  286. *<p>Formoredetailssee<code>PropertyUtilsBean</code>.</p>
  287. *
  288. *@parambeanClassBeanclasstobeintrospected
  289. *@returnthemappedpropertydescriptors
  290. *@seePropertyUtilsBean#getMappedPropertyDescriptors(Class)
  291. *@deprecatedThismethodshouldnotbeexposed
  292. */
  293. publicstaticFastHashMapgetMappedPropertyDescriptors(ClassbeanClass){
  294. returnPropertyUtilsBean.getInstance().getMappedPropertyDescriptors(beanClass);
  295. }
  296. /**
  297. *<p>Returnthemappedpropertydescriptorsforthisbean.</p>
  298. *
  299. *<p>Formoredetailssee<code>PropertyUtilsBean</code>.</p>
  300. *
  301. *@parambeanBeantobeintrospected
  302. *@returnthemappedpropertydescriptors
  303. *@seePropertyUtilsBean#getMappedPropertyDescriptors(Object)
  304. *@deprecatedThismethodshouldnotbeexposed
  305. */
  306. publicstaticFastHashMapgetMappedPropertyDescriptors(Objectbean){
  307. returnPropertyUtilsBean.getInstance().getMappedPropertyDescriptors(bean);
  308. }
  309. /**
  310. *<p>Returnthevalueofthe(possiblynested)propertyofthespecified
  311. *name,forthespecifiedbean,withnotypeconversions.</p>
  312. *
  313. *<p>Formoredetailssee<code>PropertyUtilsBean</code>.</p>
  314. *
  315. *@parambeanBeanwhosepropertyistobeextracted
  316. *@paramnamePossiblynestednameofthepropertytobeextracted
  317. *@returnthenestedpropertyvalue
  318. *
  319. *@exceptionIllegalAccessExceptionifthecallerdoesnothave
  320. *accesstothepropertyaccessormethod
  321. *@exceptionIllegalArgumentExceptionif<code>bean</code>or
  322. *<code>name</code>isnull
  323. *@exceptionNestedNullExceptionifanestedreferencetoa
  324. *propertyreturnsnull
  325. *@exceptionInvocationTargetException
  326. *ifthepropertyaccessormethodthrowsanexception
  327. *@exceptionNoSuchMethodExceptionifanaccessormethodforthis
  328. *propetycannotbefound
  329. *@seePropertyUtilsBean#getNestedProperty
  330. */
  331. publicstaticObjectgetNestedProperty(Objectbean,Stringname)
  332. throwsIllegalAccessException,InvocationTargetException,
  333. NoSuchMethodException{
  334. returnPropertyUtilsBean.getInstance().getNestedProperty(bean,name);
  335. }
  336. /**
  337. *<p>Returnthevalueofthespecifiedpropertyofthespecifiedbean,
  338. *nomatterwhichpropertyreferenceformatisused,withno
  339. *typeconversions.</p>
  340. *
  341. *<p>Formoredetailssee<code>PropertyUtilsBean</code>.</p>
  342. *
  343. *@parambeanBeanwhosepropertyistobeextracted
  344. *@paramnamePossiblyindexedand/ornestednameoftheproperty
  345. *tobeextracted
  346. *@returnthepropertyvalue
  347. *
  348. *@exceptionIllegalAccessExceptionifthecallerdoesnothave
  349. *accesstothepropertyaccessormethod
  350. *@exceptionIllegalArgumentExceptionif<code>bean</code>or
  351. *<code>name</code>isnull
  352. *@exceptionInvocationTargetExceptionifthepropertyaccessormethod
  353. *throwsanexception
  354. *@exceptionNoSuchMethodExceptionifanaccessormethodforthis
  355. *propetycannotbefound
  356. *@seePropertyUtilsBean#getProperty
  357. */
  358. publicstaticObjectgetProperty(Objectbean,Stringname)
  359. throwsIllegalAccessException,InvocationTargetException,
  360. NoSuchMethodException{
  361. return(PropertyUtilsBean.getInstance().getProperty(bean,name));
  362. }
  363. /**
  364. *<p>Retrievethepropertydescriptorforthespecifiedpropertyofthe
  365. *specifiedbean,orreturn<code>null</code>ifthereisnosuch
  366. *descriptor.</p>
  367. *
  368. *<p>Formoredetailssee<code>PropertyUtilsBean</code>.</p>
  369. *
  370. *@parambeanBeanforwhichapropertydescriptorisrequested
  371. *@paramnamePossiblyindexedand/ornestednameofthepropertyfor
  372. *whichapropertydescriptorisrequested
  373. *@returnthepropertydescriptor
  374. *
  375. *@exceptionIllegalAccessExceptionifthecallerdoesnothave
  376. *accesstothepropertyaccessormethod
  377. *@exceptionIllegalArgumentExceptionif<code>bean</code>or
  378. *<code>name</code>isnull
  379. *@exceptionIllegalArgumentExceptionifanestedreferencetoa
  380. *propertyreturnsnull
  381. *@exceptionInvocationTargetExceptionifthepropertyaccessormethod
  382. *throwsanexception
  383. *@exceptionNoSuchMethodExceptionifanaccessormethodforthis
  384. *propetycannotbefound
  385. *@seePropertyUtilsBean#getPropertyDescriptor
  386. */
  387. publicstaticPropertyDescriptorgetPropertyDescriptor(Objectbean,
  388. Stringname)
  389. throwsIllegalAccessException,InvocationTargetException,
  390. NoSuchMethodException{
  391. returnPropertyUtilsBean.getInstance().getPropertyDescriptor(bean,name);
  392. }
  393. /**
  394. *<p>Retrievethepropertydescriptorsforthespecifiedclass,
  395. *introspectingandcachingthemthefirsttimeaparticularbeanclass
  396. *isencountered.</p>
  397. *
  398. *<p>Formoredetailssee<code>PropertyUtilsBean</code>.</p>
  399. *
  400. *@parambeanClassBeanclassforwhichpropertydescriptorsarerequested
  401. *@returnthepropertydescriptors
  402. *@exceptionIllegalArgumentExceptionif<code>beanClass</code>isnull
  403. *@seePropertyUtilsBean#getPropertyDescriptors(Class)
  404. */
  405. publicstaticPropertyDescriptor[]
  406. getPropertyDescriptors(ClassbeanClass){
  407. returnPropertyUtilsBean.getInstance().getPropertyDescriptors(beanClass);
  408. }
  409. /**
  410. *<p>Retrievethepropertydescriptorsforthespecifiedbean,
  411. *introspectingandcachingthemthefirsttimeaparticularbeanclass
  412. *isencountered.</p>
  413. *
  414. *<p>Formoredetailssee<code>PropertyUtilsBean</code>.</p>
  415. *
  416. *@parambeanBeanforwhichpropertydescriptorsarerequested
  417. *@returnthepropertydescriptors
  418. *@exceptionIllegalArgumentExceptionif<code>bean</code>isnull
  419. *@seePropertyUtilsBean#getPropertyDescriptors(Object)
  420. */
  421. publicstaticPropertyDescriptor[]getPropertyDescriptors(Objectbean){
  422. returnPropertyUtilsBean.getInstance().getPropertyDescriptors(bean);
  423. }
  424. /**
  425. *<p>ReturntheJavaClassrepesentingthepropertyeditorclassthathas
  426. *beenregisteredforthisproperty(ifany).</p>
  427. *
  428. *<p>Formoredetailssee<code>PropertyUtilsBean</code>.</p>
  429. *
  430. *@parambeanBeanforwhichapropertydescriptorisrequested
  431. *@paramnamePossiblyindexedand/ornestednameofthepropertyfor
  432. *whichapropertydescriptorisrequested
  433. *@returnthepropertyeditorclass
  434. *
  435. *@exceptionIllegalAccessExceptionifthecallerdoesnothave
  436. *accesstothepropertyaccessormethod
  437. *@exceptionIllegalArgumentExceptionif<code>bean</code>or
  438. *<code>name</code>isnull
  439. *@exceptionIllegalArgumentExceptionifanestedreferencetoa
  440. *propertyreturnsnull
  441. *@exceptionInvocationTargetExceptionifthepropertyaccessormethod
  442. *throwsanexception
  443. *@exceptionNoSuchMethodExceptionifanaccessormethodforthis
  444. *propetycannotbefound
  445. *@seePropertyUtilsBean#getPropertyEditorClass(Object,String)
  446. */
  447. publicstaticClassgetPropertyEditorClass(Objectbean,Stringname)
  448. throwsIllegalAccessException,InvocationTargetException,
  449. NoSuchMethodException{
  450. returnPropertyUtilsBean.getInstance().getPropertyEditorClass(bean,name);
  451. }
  452. /**
  453. *<p>ReturntheJavaClassrepresentingthepropertytypeofthespecified
  454. *property,or<code>null</code>ifthereisnosuchpropertyforthe
  455. *specifiedbean.</p>
  456. *
  457. *<p>Formoredetailssee<code>PropertyUtilsBean</code>.</p>
  458. *
  459. *@parambeanBeanforwhichapropertydescriptorisrequested
  460. *@paramnamePossiblyindexedand/ornestednameofthepropertyfor
  461. *whichapropertydescriptorisrequested
  462. *@returnThepropertytype
  463. *
  464. *@exceptionIllegalAccessExceptionifthecallerdoesnothave
  465. *accesstothepropertyaccessormethod
  466. *@exceptionIllegalArgumentExceptionif<code>bean</code>or
  467. *<code>name</code>isnull
  468. *@exceptionIllegalArgumentExceptionifanestedreferencetoa
  469. *propertyreturnsnull
  470. *@exceptionInvocationTargetExceptionifthepropertyaccessormethod
  471. *throwsanexception
  472. *@exceptionNoSuchMethodExceptionifanaccessormethodforthis
  473. *propetycannotbefound
  474. *@seePropertyUtilsBean#getPropertyType(Object,String)
  475. */
  476. publicstaticClassgetPropertyType(Objectbean,Stringname)
  477. throwsIllegalAccessException,InvocationTargetException,
  478. NoSuchMethodException{
  479. returnPropertyUtilsBean.getInstance().getPropertyType(bean,name);
  480. }
  481. /**
  482. *<p>Returnanaccessiblepropertygettermethodforthisproperty,
  483. *ifthereisone;otherwisereturn<code>null</code>.</p>
  484. *
  485. *<p>Formoredetailssee<code>PropertyUtilsBean</code>.</p>
  486. *
  487. *@paramdescriptorPropertydescriptortoreturnagetterfor
  488. *@returnThereadmethod
  489. *@seePropertyUtilsBean#getReadMethod(PropertyDescriptor)
  490. */
  491. publicstaticMethodgetReadMethod(PropertyDescriptordescriptor){
  492. return(PropertyUtilsBean.getInstance().getReadMethod(descriptor));
  493. }
  494. /**
  495. *<p>Returnthevalueofthespecifiedsimplepropertyofthespecified
  496. *bean,withnotypeconversions.</p>
  497. *
  498. *<p>Formoredetailssee<code>PropertyUtilsBean</code>.</p>
  499. *
  500. *@parambeanBeanwhosepropertyistobeextracted
  501. *@paramnameNameofthepropertytobeextracted
  502. *@returnThepropertyvalue
  503. *
  504. *@exceptionIllegalAccessExceptionifthecallerdoesnothave
  505. *accesstothepropertyaccessormethod
  506. *@exceptionIllegalArgumentExceptionif<code>bean</code>or
  507. *<code>name</code>isnull
  508. *@exceptionIllegalArgumentExceptionifthepropertyname
  509. *isnestedorindexed
  510. *@exceptionInvocationTargetExceptionifthepropertyaccessormethod
  511. *throwsanexception
  512. *@exceptionNoSuchMethodExceptionifanaccessormethodforthis
  513. *propetycannotbefound
  514. *@seePropertyUtilsBean#getSimpleProperty
  515. */
  516. publicstaticObjectgetSimpleProperty(Objectbean,Stringname)
  517. throwsIllegalAccessException,InvocationTargetException,
  518. NoSuchMethodException{
  519. returnPropertyUtilsBean.getInstance().getSimpleProperty(bean,name);
  520. }
  521. /**
  522. *<p>Returnanaccessiblepropertysettermethodforthisproperty,
  523. *ifthereisone;otherwisereturn<code>null</code>.</p>
  524. *
  525. *<p>Formoredetailssee<code>PropertyUtilsBean</code>.</p>
  526. *
  527. *@paramdescriptorPropertydescriptortoreturnasetterfor
  528. *@returnThewritemethod
  529. *@seePropertyUtilsBean#getWriteMethod(PropertyDescriptor)
  530. */
  531. publicstaticMethodgetWriteMethod(PropertyDescriptordescriptor){
  532. returnPropertyUtilsBean.getInstance().getWriteMethod(descriptor);
  533. }
  534. /**
  535. *<p>Return<code>true</code>ifthespecifiedpropertynameidentifies
  536. *areadablepropertyonthespecifiedbean;otherwise,return
  537. *<code>false</code>.</p>
  538. *
  539. *<p>Formoredetailssee<code>PropertyUtilsBean</code>.</p>
  540. *
  541. *@parambeanBeantobeexamined(maybea{@linkDynaBean}
  542. *@paramnamePropertynametobeevaluated
  543. *@return<code>true</code>ifthepropertyisreadable,
  544. *otherwise<code>false</code>
  545. *
  546. *@exceptionIllegalArgumentExceptionif<code>bean</code>
  547. *or<code>name</code>is<code>null</code>
  548. *@seePropertyUtilsBean#isReadable
  549. *@sinceBeanUtils1.6
  550. */
  551. publicstaticbooleanisReadable(Objectbean,Stringname){
  552. returnPropertyUtilsBean.getInstance().isReadable(bean,name);
  553. }
  554. /**
  555. *<p>Return<code>true</code>ifthespecifiedpropertynameidentifies
  556. *awriteablepropertyonthespecifiedbean;otherwise,return
  557. *<code>false</code>.</p>
  558. *
  559. *<p>Formoredetailssee<code>PropertyUtilsBean</code>.</p>
  560. *
  561. *@parambeanBeantobeexamined(maybea{@linkDynaBean}
  562. *@paramnamePropertynametobeevaluated
  563. *@return<code>true</code>ifthepropertyiswriteable,
  564. *otherwise<code>false</code>
  565. *
  566. *@exceptionIllegalArgumentExceptionif<code>bean</code>
  567. *or<code>name</code>is<code>null</code>
  568. *@seePropertyUtilsBean#isWriteable
  569. *@sinceBeanUtils1.6
  570. */
  571. publicstaticbooleanisWriteable(Objectbean,Stringname){
  572. returnPropertyUtilsBean.getInstance().isWriteable(bean,name);
  573. }
  574. /**
  575. *<p>Setsthevalueofthespecifiedindexedpropertyofthespecified
  576. *bean,withnotypeconversions.</p>
  577. *
  578. *<p>Formoredetailssee<code>PropertyUtilsBean</code>.</p>
  579. *
  580. *@parambeanBeanwhosepropertyistobemodified
  581. *@paramname<code>propertyname[index]</code>ofthepropertyvalue
  582. *tobemodified
  583. *@paramvalueValuetowhichthespecifiedpropertyelement
  584. *shouldbeset
  585. *
  586. *@exceptionIndexOutOfBoundsExceptionifthespecifiedindex
  587. *isoutsidethevalidrangefortheunderlyingproperty
  588. *@exceptionIllegalAccessExceptionifthecallerdoesnothave
  589. *accesstothepropertyaccessormethod
  590. *@exceptionIllegalArgumentExceptionif<code>bean</code>or
  591. *<code>name</code>isnull
  592. *@exceptionInvocationTargetExceptionifthepropertyaccessormethod
  593. *throwsanexception
  594. *@exceptionNoSuchMethodExceptionifanaccessormethodforthis
  595. *propetycannotbefound
  596. *@seePropertyUtilsBean#setIndexedProperty(Object,String,Object)
  597. */
  598. publicstaticvoidsetIndexedProperty(Objectbean,Stringname,
  599. Objectvalue)
  600. throwsIllegalAccessException,InvocationTargetException,
  601. NoSuchMethodException{
  602. PropertyUtilsBean.getInstance().setIndexedProperty(bean,name,value);
  603. }
  604. /**
  605. *<p>Setsthevalueofthespecifiedindexedpropertyofthespecified
  606. *bean,withnotypeconversions.</p>
  607. *
  608. *<p>Formoredetailssee<code>PropertyUtilsBean</code>.</p>
  609. *
  610. *@parambeanBeanwhosepropertyistobeset
  611. *@paramnameSimplepropertynameofthepropertyvaluetobeset
  612. *@paramindexIndexofthepropertyvaluetobeset
  613. *@paramvalueValuetowhichtheindexedpropertyelementistobeset
  614. *
  615. *@exceptionIndexOutOfBoundsExceptionifthespecifiedindex
  616. *isoutsidethevalidrangefortheunderlyingproperty
  617. *@exceptionIllegalAccessExceptionifthecallerdoesnothave
  618. *accesstothepropertyaccessormethod
  619. *@exceptionIllegalArgumentExceptionif<code>bean</code>or
  620. *<code>name</code>isnull
  621. *@exceptionInvocationTargetExceptionifthepropertyaccessormethod
  622. *throwsanexception
  623. *@exceptionNoSuchMethodExceptionifanaccessormethodforthis
  624. *propetycannotbefound
  625. *@seePropertyUtilsBean#setIndexedProperty(Object,String,Object)
  626. */
  627. publicstaticvoidsetIndexedProperty(Objectbean,Stringname,
  628. intindex,Objectvalue)
  629. throwsIllegalAccessException,InvocationTargetException,
  630. NoSuchMethodException{
  631. PropertyUtilsBean.getInstance().setIndexedProperty(bean,name,index,value);
  632. }
  633. /**
  634. *<p>Setsthevalueofthespecifiedmappedpropertyofthe
  635. *specifiedbean,withnotypeconversions.</p>
  636. *
  637. *<p>Formoredetailssee<code>PropertyUtilsBean</code>.</p>
  638. *
  639. *@parambeanBeanwhosepropertyistobeset
  640. *@paramname<code>propertyname(key)</code>ofthepropertyvalue
  641. *tobeset
  642. *@paramvalueThepropertyvaluetobeset
  643. *
  644. *@exceptionIllegalAccessExceptionifthecallerdoesnothave
  645. *accesstothepropertyaccessormethod
  646. *@exceptionInvocationTargetExceptionifthepropertyaccessormethod
  647. *throwsanexception
  648. *@exceptionNoSuchMethodExceptionifanaccessormethodforthis
  649. *propetycannotbefound
  650. *@seePropertyUtilsBean#setMappedProperty(Object,String,Object)
  651. */
  652. publicstaticvoidsetMappedProperty(Objectbean,Stringname,
  653. Objectvalue)
  654. throwsIllegalAccessException,InvocationTargetException,
  655. NoSuchMethodException{
  656. PropertyUtilsBean.getInstance().setMappedProperty(bean,name,value);
  657. }
  658. /**
  659. *<p>Setsthevalueofthespecifiedmappedpropertyofthespecified
  660. *bean,withnotypeconversions.</p>
  661. *
  662. *<p>Formoredetailssee<code>PropertyUtilsBean</code>.</p>
  663. *
  664. *@parambeanBeanwhosepropertyistobeset
  665. *@paramnameMappedpropertynameofthepropertyvaluetobeset
  666. *@paramkeyKeyofthepropertyvaluetobeset
  667. *@paramvalueThepropertyvaluetobeset
  668. *
  669. *@exceptionIllegalAccessExceptionifthecallerdoesnothave
  670. *accesstothepropertyaccessormethod
  671. *@exceptionInvocationTargetExceptionifthepropertyaccessormethod
  672. *throwsanexception
  673. *@exceptionNoSuchMethodExceptionifanaccessormethodforthis
  674. *propetycannotbefound
  675. *@seePropertyUtilsBean#setMappedProperty(Object,String,String,Object)
  676. */
  677. publicstaticvoidsetMappedProperty(Objectbean,Stringname,
  678. Stringkey,Objectvalue)
  679. throwsIllegalAccessException,InvocationTargetException,
  680. NoSuchMethodException{
  681. PropertyUtilsBean.getInstance().setMappedProperty(bean,name,key,value);
  682. }
  683. /**
  684. *<p>Setsthevalueofthe(possiblynested)propertyofthespecified
  685. *name,forthespecifiedbean,withnotypeconversions.</p>
  686. *
  687. *<p>Formoredetailssee<code>PropertyUtilsBean</code>.</p>
  688. *
  689. *@parambeanBeanwhosepropertyistobemodified
  690. *@paramnamePossiblynestednameofthepropertytobemodified
  691. *@paramvalueValuetowhichthepropertyistobeset
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值