You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CtClass.html 132KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169
  1. <!DOCTYPE HTML>
  2. <!-- NewPage -->
  3. <html lang="en">
  4. <head>
  5. <!-- Generated by javadoc (11) on Sat May 08 11:16:00 JST 2021 -->
  6. <title>CtClass (Javassist API)</title>
  7. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  8. <meta name="dc.created" content="2021-05-08">
  9. <link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style">
  10. <link rel="stylesheet" type="text/css" href="../jquery/jquery-ui.css" title="Style">
  11. <script type="text/javascript" src="../script.js"></script>
  12. <script type="text/javascript" src="../jquery/jszip/dist/jszip.min.js"></script>
  13. <script type="text/javascript" src="../jquery/jszip-utils/dist/jszip-utils.min.js"></script>
  14. <!--[if IE]>
  15. <script type="text/javascript" src="../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script>
  16. <![endif]-->
  17. <script type="text/javascript" src="../jquery/jquery-3.3.1.js"></script>
  18. <script type="text/javascript" src="../jquery/jquery-migrate-3.0.1.js"></script>
  19. <script type="text/javascript" src="../jquery/jquery-ui.js"></script>
  20. </head>
  21. <body>
  22. <script type="text/javascript"><!--
  23. try {
  24. if (location.href.indexOf('is-external=true') == -1) {
  25. parent.document.title="CtClass (Javassist API)";
  26. }
  27. }
  28. catch(err) {
  29. }
  30. //-->
  31. var data = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10,"i14":10,"i15":10,"i16":10,"i17":10,"i18":10,"i19":10,"i20":10,"i21":10,"i22":10,"i23":10,"i24":10,"i25":10,"i26":10,"i27":10,"i28":10,"i29":10,"i30":10,"i31":10,"i32":10,"i33":10,"i34":10,"i35":10,"i36":42,"i37":10,"i38":10,"i39":10,"i40":10,"i41":10,"i42":10,"i43":10,"i44":10,"i45":10,"i46":10,"i47":10,"i48":10,"i49":10,"i50":10,"i51":10,"i52":10,"i53":10,"i54":10,"i55":10,"i56":10,"i57":10,"i58":10,"i59":10,"i60":10,"i61":10,"i62":10,"i63":10,"i64":9,"i65":10,"i66":10,"i67":10,"i68":10,"i69":10,"i70":10,"i71":10,"i72":10,"i73":10,"i74":10,"i75":10,"i76":10,"i77":10,"i78":10,"i79":10,"i80":10,"i81":10,"i82":10,"i83":10,"i84":10,"i85":10,"i86":10,"i87":10,"i88":42,"i89":10,"i90":10,"i91":10,"i92":10,"i93":10};
  32. var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"],32:["t6","Deprecated Methods"]};
  33. var altColor = "altColor";
  34. var rowColor = "rowColor";
  35. var tableTab = "tableTab";
  36. var activeTableTab = "activeTableTab";
  37. var pathtoroot = "../";
  38. var useModuleDirectories = true;
  39. loadScripts(document, 'script');</script>
  40. <noscript>
  41. <div>JavaScript is disabled on your browser.</div>
  42. </noscript>
  43. <header role="banner">
  44. <nav role="navigation">
  45. <div class="fixedNav">
  46. <!-- ========= START OF TOP NAVBAR ======= -->
  47. <div class="topNav"><a id="navbar.top">
  48. <!-- -->
  49. </a>
  50. <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
  51. <a id="navbar.top.firstrow">
  52. <!-- -->
  53. </a>
  54. <ul class="navList" title="Navigation">
  55. <li><a href="../index.html">Overview</a></li>
  56. <li><a href="package-summary.html">Package</a></li>
  57. <li class="navBarCell1Rev">Class</li>
  58. <li><a href="class-use/CtClass.html">Use</a></li>
  59. <li><a href="package-tree.html">Tree</a></li>
  60. <li><a href="../deprecated-list.html">Deprecated</a></li>
  61. <li><a href="../index-all.html">Index</a></li>
  62. </ul>
  63. </div>
  64. <div class="subNav">
  65. <ul class="navList" id="allclasses_navbar_top">
  66. <li><a href="../allclasses.html">All&nbsp;Classes</a></li>
  67. </ul>
  68. <ul class="navListSearch">
  69. <li><label for="search">SEARCH:</label>
  70. <input type="text" id="search" value="search" disabled="disabled">
  71. <input type="reset" id="reset" value="reset" disabled="disabled">
  72. </li>
  73. </ul>
  74. <div>
  75. <script type="text/javascript"><!--
  76. allClassesLink = document.getElementById("allclasses_navbar_top");
  77. if(window==top) {
  78. allClassesLink.style.display = "block";
  79. }
  80. else {
  81. allClassesLink.style.display = "none";
  82. }
  83. //-->
  84. </script>
  85. <noscript>
  86. <div>JavaScript is disabled on your browser.</div>
  87. </noscript>
  88. </div>
  89. <div>
  90. <ul class="subNavList">
  91. <li>Summary:&nbsp;</li>
  92. <li>Nested&nbsp;|&nbsp;</li>
  93. <li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
  94. <li>Constr&nbsp;|&nbsp;</li>
  95. <li><a href="#method.summary">Method</a></li>
  96. </ul>
  97. <ul class="subNavList">
  98. <li>Detail:&nbsp;</li>
  99. <li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
  100. <li>Constr&nbsp;|&nbsp;</li>
  101. <li><a href="#method.detail">Method</a></li>
  102. </ul>
  103. </div>
  104. <a id="skip.navbar.top">
  105. <!-- -->
  106. </a></div>
  107. <!-- ========= END OF TOP NAVBAR ========= -->
  108. </div>
  109. <div class="navPadding">&nbsp;</div>
  110. <script type="text/javascript"><!--
  111. $('.navPadding').css('padding-top', $('.fixedNav').css("height"));
  112. //-->
  113. </script>
  114. </nav>
  115. </header>
  116. <!-- ======== START OF CLASS DATA ======== -->
  117. <main role="main">
  118. <div class="header">
  119. <div class="subTitle"><span class="packageLabelInType">Package</span>&nbsp;<a href="package-summary.html">javassist</a></div>
  120. <h2 title="Class CtClass" class="title">Class CtClass</h2>
  121. </div>
  122. <div class="contentContainer">
  123. <ul class="inheritance">
  124. <li>java.lang.Object</li>
  125. <li>
  126. <ul class="inheritance">
  127. <li>javassist.CtClass</li>
  128. </ul>
  129. </li>
  130. </ul>
  131. <div class="description">
  132. <ul class="blockList">
  133. <li class="blockList">
  134. <dl>
  135. <dt>Direct Known Subclasses:</dt>
  136. <dd><code><a href="CtPrimitiveType.html" title="class in javassist">CtPrimitiveType</a></code></dd>
  137. </dl>
  138. <hr>
  139. <pre>public abstract class <span class="typeNameLabel">CtClass</span>
  140. extends java.lang.Object</pre>
  141. <div class="block">An instance of <code>CtClass</code> represents a class.
  142. It is obtained from <code>ClassPool</code>.</div>
  143. <dl>
  144. <dt><span class="seeLabel">See Also:</span></dt>
  145. <dd><a href="ClassPool.html#get(java.lang.String)"><code>ClassPool.get(String)</code></a></dd>
  146. </dl>
  147. </li>
  148. </ul>
  149. </div>
  150. <div class="summary">
  151. <ul class="blockList">
  152. <li class="blockList">
  153. <!-- =========== FIELD SUMMARY =========== -->
  154. <section role="region">
  155. <ul class="blockList">
  156. <li class="blockList"><a id="field.summary">
  157. <!-- -->
  158. </a>
  159. <h3>Field Summary</h3>
  160. <table class="memberSummary">
  161. <caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption>
  162. <tr>
  163. <th class="colFirst" scope="col">Modifier and Type</th>
  164. <th class="colSecond" scope="col">Field</th>
  165. <th class="colLast" scope="col">Description</th>
  166. </tr>
  167. <tr class="altColor">
  168. <td class="colFirst"><code>static <a href="CtClass.html" title="class in javassist">CtClass</a></code></td>
  169. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#booleanType">booleanType</a></span></code></th>
  170. <td class="colLast">
  171. <div class="block">The <code>CtClass</code> object representing
  172. the <code>boolean</code> type.</div>
  173. </td>
  174. </tr>
  175. <tr class="rowColor">
  176. <td class="colFirst"><code>static <a href="CtClass.html" title="class in javassist">CtClass</a></code></td>
  177. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#byteType">byteType</a></span></code></th>
  178. <td class="colLast">
  179. <div class="block">The <code>CtClass</code> object representing
  180. the <code>byte</code> type.</div>
  181. </td>
  182. </tr>
  183. <tr class="altColor">
  184. <td class="colFirst"><code>static <a href="CtClass.html" title="class in javassist">CtClass</a></code></td>
  185. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#charType">charType</a></span></code></th>
  186. <td class="colLast">
  187. <div class="block">The <code>CtClass</code> object representing
  188. the <code>char</code> type.</div>
  189. </td>
  190. </tr>
  191. <tr class="rowColor">
  192. <td class="colFirst"><code>static java.lang.String</code></td>
  193. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#debugDump">debugDump</a></span></code></th>
  194. <td class="colLast">
  195. <div class="block">If the value of this field is not null, then all class
  196. files modified by Javassist are saved under the directory
  197. specified by this variable.</div>
  198. </td>
  199. </tr>
  200. <tr class="altColor">
  201. <td class="colFirst"><code>static <a href="CtClass.html" title="class in javassist">CtClass</a></code></td>
  202. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#doubleType">doubleType</a></span></code></th>
  203. <td class="colLast">
  204. <div class="block">The <code>CtClass</code> object representing
  205. the <code>double</code> type.</div>
  206. </td>
  207. </tr>
  208. <tr class="rowColor">
  209. <td class="colFirst"><code>static <a href="CtClass.html" title="class in javassist">CtClass</a></code></td>
  210. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#floatType">floatType</a></span></code></th>
  211. <td class="colLast">
  212. <div class="block">The <code>CtClass</code> object representing
  213. the <code>float</code> type.</div>
  214. </td>
  215. </tr>
  216. <tr class="altColor">
  217. <td class="colFirst"><code>static <a href="CtClass.html" title="class in javassist">CtClass</a></code></td>
  218. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#intType">intType</a></span></code></th>
  219. <td class="colLast">
  220. <div class="block">The <code>CtClass</code> object representing
  221. the <code>int</code> type.</div>
  222. </td>
  223. </tr>
  224. <tr class="rowColor">
  225. <td class="colFirst"><code>static <a href="CtClass.html" title="class in javassist">CtClass</a></code></td>
  226. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#longType">longType</a></span></code></th>
  227. <td class="colLast">
  228. <div class="block">The <code>CtClass</code> object representing
  229. the <code>long</code> type.</div>
  230. </td>
  231. </tr>
  232. <tr class="altColor">
  233. <td class="colFirst"><code>static <a href="CtClass.html" title="class in javassist">CtClass</a></code></td>
  234. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#shortType">shortType</a></span></code></th>
  235. <td class="colLast">
  236. <div class="block">The <code>CtClass</code> object representing
  237. the <code>short</code> type.</div>
  238. </td>
  239. </tr>
  240. <tr class="rowColor">
  241. <td class="colFirst"><code>static java.lang.String</code></td>
  242. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#version">version</a></span></code></th>
  243. <td class="colLast">
  244. <div class="block">The version number of this release.</div>
  245. </td>
  246. </tr>
  247. <tr class="altColor">
  248. <td class="colFirst"><code>static <a href="CtClass.html" title="class in javassist">CtClass</a></code></td>
  249. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#voidType">voidType</a></span></code></th>
  250. <td class="colLast">
  251. <div class="block">The <code>CtClass</code> object representing
  252. the <code>void</code> type.</div>
  253. </td>
  254. </tr>
  255. </table>
  256. </li>
  257. </ul>
  258. </section>
  259. <!-- ========== METHOD SUMMARY =========== -->
  260. <section role="region">
  261. <ul class="blockList">
  262. <li class="blockList"><a id="method.summary">
  263. <!-- -->
  264. </a>
  265. <h3>Method Summary</h3>
  266. <table class="memberSummary">
  267. <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t6" class="tableTab"><span><a href="javascript:show(32);">Deprecated Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
  268. <tr>
  269. <th class="colFirst" scope="col">Modifier and Type</th>
  270. <th class="colSecond" scope="col">Method</th>
  271. <th class="colLast" scope="col">Description</th>
  272. </tr>
  273. <tr id="i0" class="altColor">
  274. <td class="colFirst"><code>void</code></td>
  275. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#addConstructor(javassist.CtConstructor)">addConstructor</a></span>&#8203;(<a href="CtConstructor.html" title="class in javassist">CtConstructor</a>&nbsp;c)</code></th>
  276. <td class="colLast">
  277. <div class="block">Adds a constructor.</div>
  278. </td>
  279. </tr>
  280. <tr id="i1" class="rowColor">
  281. <td class="colFirst"><code>void</code></td>
  282. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#addField(javassist.CtField)">addField</a></span>&#8203;(<a href="CtField.html" title="class in javassist">CtField</a>&nbsp;f)</code></th>
  283. <td class="colLast">
  284. <div class="block">Adds a field.</div>
  285. </td>
  286. </tr>
  287. <tr id="i2" class="altColor">
  288. <td class="colFirst"><code>void</code></td>
  289. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#addField(javassist.CtField,java.lang.String)">addField</a></span>&#8203;(<a href="CtField.html" title="class in javassist">CtField</a>&nbsp;f,
  290. java.lang.String&nbsp;init)</code></th>
  291. <td class="colLast">
  292. <div class="block">Adds a field with an initial value.</div>
  293. </td>
  294. </tr>
  295. <tr id="i3" class="rowColor">
  296. <td class="colFirst"><code>void</code></td>
  297. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#addField(javassist.CtField,javassist.CtField.Initializer)">addField</a></span>&#8203;(<a href="CtField.html" title="class in javassist">CtField</a>&nbsp;f,
  298. <a href="CtField.Initializer.html" title="class in javassist">CtField.Initializer</a>&nbsp;init)</code></th>
  299. <td class="colLast">
  300. <div class="block">Adds a field with an initial value.</div>
  301. </td>
  302. </tr>
  303. <tr id="i4" class="altColor">
  304. <td class="colFirst"><code>void</code></td>
  305. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#addInterface(javassist.CtClass)">addInterface</a></span>&#8203;(<a href="CtClass.html" title="class in javassist">CtClass</a>&nbsp;anInterface)</code></th>
  306. <td class="colLast">
  307. <div class="block">Adds an interface.</div>
  308. </td>
  309. </tr>
  310. <tr id="i5" class="rowColor">
  311. <td class="colFirst"><code>void</code></td>
  312. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#addMethod(javassist.CtMethod)">addMethod</a></span>&#8203;(<a href="CtMethod.html" title="class in javassist">CtMethod</a>&nbsp;m)</code></th>
  313. <td class="colLast">
  314. <div class="block">Adds a method.</div>
  315. </td>
  316. </tr>
  317. <tr id="i6" class="altColor">
  318. <td class="colFirst"><code>void</code></td>
  319. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#debugWriteFile()">debugWriteFile</a></span>()</code></th>
  320. <td class="colLast">
  321. <div class="block">Writes a class file as <code>writeFile()</code> does although this
  322. method does not prune or freeze the class after writing the class
  323. file.</div>
  324. </td>
  325. </tr>
  326. <tr id="i7" class="rowColor">
  327. <td class="colFirst"><code>void</code></td>
  328. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#debugWriteFile(java.lang.String)">debugWriteFile</a></span>&#8203;(java.lang.String&nbsp;directoryName)</code></th>
  329. <td class="colLast">
  330. <div class="block">Writes a class file as <code>writeFile()</code> does although this
  331. method does not prune or freeze the class after writing the class
  332. file.</div>
  333. </td>
  334. </tr>
  335. <tr id="i8" class="altColor">
  336. <td class="colFirst"><code>void</code></td>
  337. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#defrost()">defrost</a></span>()</code></th>
  338. <td class="colLast">
  339. <div class="block">Defrosts the class so that the class can be modified again.</div>
  340. </td>
  341. </tr>
  342. <tr id="i9" class="rowColor">
  343. <td class="colFirst"><code>void</code></td>
  344. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#detach()">detach</a></span>()</code></th>
  345. <td class="colLast">
  346. <div class="block">Removes this <code>CtClass</code> object from the
  347. <code>ClassPool</code>.</div>
  348. </td>
  349. </tr>
  350. <tr id="i10" class="altColor">
  351. <td class="colFirst"><code>void</code></td>
  352. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#freeze()">freeze</a></span>()</code></th>
  353. <td class="colLast">
  354. <div class="block">Makes the class frozen.</div>
  355. </td>
  356. </tr>
  357. <tr id="i11" class="rowColor">
  358. <td class="colFirst"><code>javassist.compiler.AccessorMaker</code></td>
  359. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getAccessorMaker()">getAccessorMaker</a></span>()</code></th>
  360. <td class="colLast">
  361. <div class="block">Undocumented method.</div>
  362. </td>
  363. </tr>
  364. <tr id="i12" class="altColor">
  365. <td class="colFirst"><code>java.lang.Object</code></td>
  366. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getAnnotation(java.lang.Class)">getAnnotation</a></span>&#8203;(java.lang.Class&lt;?&gt;&nbsp;clz)</code></th>
  367. <td class="colLast">
  368. <div class="block">Returns the annotation if the class has the specified annotation type.</div>
  369. </td>
  370. </tr>
  371. <tr id="i13" class="rowColor">
  372. <td class="colFirst"><code>java.lang.Object[]</code></td>
  373. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getAnnotations()">getAnnotations</a></span>()</code></th>
  374. <td class="colLast">
  375. <div class="block">Returns the annotations associated with this class.</div>
  376. </td>
  377. </tr>
  378. <tr id="i14" class="altColor">
  379. <td class="colFirst"><code>byte[]</code></td>
  380. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getAttribute(java.lang.String)">getAttribute</a></span>&#8203;(java.lang.String&nbsp;name)</code></th>
  381. <td class="colLast">
  382. <div class="block">Obtains an attribute with the given name.</div>
  383. </td>
  384. </tr>
  385. <tr id="i15" class="rowColor">
  386. <td class="colFirst"><code>java.lang.Object[]</code></td>
  387. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getAvailableAnnotations()">getAvailableAnnotations</a></span>()</code></th>
  388. <td class="colLast">
  389. <div class="block">Returns the annotations associated with this class.</div>
  390. </td>
  391. </tr>
  392. <tr id="i16" class="altColor">
  393. <td class="colFirst"><code><a href="bytecode/ClassFile.html" title="class in javassist.bytecode">ClassFile</a></code></td>
  394. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getClassFile()">getClassFile</a></span>()</code></th>
  395. <td class="colLast">
  396. <div class="block">Returns a class file for this class.</div>
  397. </td>
  398. </tr>
  399. <tr id="i17" class="rowColor">
  400. <td class="colFirst"><code><a href="bytecode/ClassFile.html" title="class in javassist.bytecode">ClassFile</a></code></td>
  401. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getClassFile2()">getClassFile2</a></span>()</code></th>
  402. <td class="colLast">
  403. <div class="block">Returns a class file for this class (read only).</div>
  404. </td>
  405. </tr>
  406. <tr id="i18" class="altColor">
  407. <td class="colFirst"><code><a href="CtConstructor.html" title="class in javassist">CtConstructor</a></code></td>
  408. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getClassInitializer()">getClassInitializer</a></span>()</code></th>
  409. <td class="colLast">
  410. <div class="block">Gets the class initializer (static constructor)
  411. declared in the class.</div>
  412. </td>
  413. </tr>
  414. <tr id="i19" class="rowColor">
  415. <td class="colFirst"><code><a href="ClassPool.html" title="class in javassist">ClassPool</a></code></td>
  416. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getClassPool()">getClassPool</a></span>()</code></th>
  417. <td class="colLast">
  418. <div class="block">Returns a <code>ClassPool</code> for this class.</div>
  419. </td>
  420. </tr>
  421. <tr id="i20" class="altColor">
  422. <td class="colFirst"><code><a href="CtClass.html" title="class in javassist">CtClass</a></code></td>
  423. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getComponentType()">getComponentType</a></span>()</code></th>
  424. <td class="colLast">
  425. <div class="block">If this object represents an array, this method returns the component
  426. type of the array.</div>
  427. </td>
  428. </tr>
  429. <tr id="i21" class="rowColor">
  430. <td class="colFirst"><code><a href="CtConstructor.html" title="class in javassist">CtConstructor</a></code></td>
  431. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getConstructor(java.lang.String)">getConstructor</a></span>&#8203;(java.lang.String&nbsp;desc)</code></th>
  432. <td class="colLast">
  433. <div class="block">Returns the constructor with the given signature,
  434. which is represented by a character string
  435. called method descriptor.</div>
  436. </td>
  437. </tr>
  438. <tr id="i22" class="altColor">
  439. <td class="colFirst"><code><a href="CtConstructor.html" title="class in javassist">CtConstructor</a>[]</code></td>
  440. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getConstructors()">getConstructors</a></span>()</code></th>
  441. <td class="colLast">
  442. <div class="block">Returns an array containing <code>CtConstructor</code> objects
  443. representing all the non-private constructors of the class.</div>
  444. </td>
  445. </tr>
  446. <tr id="i23" class="rowColor">
  447. <td class="colFirst"><code><a href="CtBehavior.html" title="class in javassist">CtBehavior</a>[]</code></td>
  448. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getDeclaredBehaviors()">getDeclaredBehaviors</a></span>()</code></th>
  449. <td class="colLast">
  450. <div class="block">Gets all the constructors and methods declared in the class.</div>
  451. </td>
  452. </tr>
  453. <tr id="i24" class="altColor">
  454. <td class="colFirst"><code><a href="CtClass.html" title="class in javassist">CtClass</a>[]</code></td>
  455. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getDeclaredClasses()">getDeclaredClasses</a></span>()</code></th>
  456. <td class="colLast">
  457. <div class="block">Returns an array of nested classes declared in the class.</div>
  458. </td>
  459. </tr>
  460. <tr id="i25" class="rowColor">
  461. <td class="colFirst"><code><a href="CtConstructor.html" title="class in javassist">CtConstructor</a></code></td>
  462. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getDeclaredConstructor(javassist.CtClass%5B%5D)">getDeclaredConstructor</a></span>&#8203;(<a href="CtClass.html" title="class in javassist">CtClass</a>[]&nbsp;params)</code></th>
  463. <td class="colLast">
  464. <div class="block">Returns a constructor receiving the specified parameters.</div>
  465. </td>
  466. </tr>
  467. <tr id="i26" class="altColor">
  468. <td class="colFirst"><code><a href="CtConstructor.html" title="class in javassist">CtConstructor</a>[]</code></td>
  469. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getDeclaredConstructors()">getDeclaredConstructors</a></span>()</code></th>
  470. <td class="colLast">
  471. <div class="block">Gets all the constructors declared in the class.</div>
  472. </td>
  473. </tr>
  474. <tr id="i27" class="rowColor">
  475. <td class="colFirst"><code><a href="CtField.html" title="class in javassist">CtField</a></code></td>
  476. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getDeclaredField(java.lang.String)">getDeclaredField</a></span>&#8203;(java.lang.String&nbsp;name)</code></th>
  477. <td class="colLast">
  478. <div class="block">Retrieves the field with the specified name among the fields
  479. declared in the class.</div>
  480. </td>
  481. </tr>
  482. <tr id="i28" class="altColor">
  483. <td class="colFirst"><code><a href="CtField.html" title="class in javassist">CtField</a></code></td>
  484. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getDeclaredField(java.lang.String,java.lang.String)">getDeclaredField</a></span>&#8203;(java.lang.String&nbsp;name,
  485. java.lang.String&nbsp;desc)</code></th>
  486. <td class="colLast">
  487. <div class="block">Retrieves the field with the specified name and type among the fields
  488. declared in the class.</div>
  489. </td>
  490. </tr>
  491. <tr id="i29" class="rowColor">
  492. <td class="colFirst"><code><a href="CtField.html" title="class in javassist">CtField</a>[]</code></td>
  493. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getDeclaredFields()">getDeclaredFields</a></span>()</code></th>
  494. <td class="colLast">
  495. <div class="block">Gets all the fields declared in the class.</div>
  496. </td>
  497. </tr>
  498. <tr id="i30" class="altColor">
  499. <td class="colFirst"><code><a href="CtMethod.html" title="class in javassist">CtMethod</a></code></td>
  500. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getDeclaredMethod(java.lang.String)">getDeclaredMethod</a></span>&#8203;(java.lang.String&nbsp;name)</code></th>
  501. <td class="colLast">
  502. <div class="block">Retrieves the method with the specified name among the methods
  503. declared in the class.</div>
  504. </td>
  505. </tr>
  506. <tr id="i31" class="rowColor">
  507. <td class="colFirst"><code><a href="CtMethod.html" title="class in javassist">CtMethod</a></code></td>
  508. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getDeclaredMethod(java.lang.String,javassist.CtClass%5B%5D)">getDeclaredMethod</a></span>&#8203;(java.lang.String&nbsp;name,
  509. <a href="CtClass.html" title="class in javassist">CtClass</a>[]&nbsp;params)</code></th>
  510. <td class="colLast">
  511. <div class="block">Retrieves the method with the specified name and parameter types
  512. among the methods declared in the class.</div>
  513. </td>
  514. </tr>
  515. <tr id="i32" class="altColor">
  516. <td class="colFirst"><code><a href="CtMethod.html" title="class in javassist">CtMethod</a>[]</code></td>
  517. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getDeclaredMethods()">getDeclaredMethods</a></span>()</code></th>
  518. <td class="colLast">
  519. <div class="block">Gets all methods declared in the class.</div>
  520. </td>
  521. </tr>
  522. <tr id="i33" class="rowColor">
  523. <td class="colFirst"><code><a href="CtMethod.html" title="class in javassist">CtMethod</a>[]</code></td>
  524. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getDeclaredMethods(java.lang.String)">getDeclaredMethods</a></span>&#8203;(java.lang.String&nbsp;name)</code></th>
  525. <td class="colLast">
  526. <div class="block">Retrieves methods with the specified name among the methods
  527. declared in the class.</div>
  528. </td>
  529. </tr>
  530. <tr id="i34" class="altColor">
  531. <td class="colFirst"><code><a href="CtClass.html" title="class in javassist">CtClass</a></code></td>
  532. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getDeclaringClass()">getDeclaringClass</a></span>()</code></th>
  533. <td class="colLast">
  534. <div class="block">If this class is a member class or interface of another class,
  535. then the class enclosing this class is returned.</div>
  536. </td>
  537. </tr>
  538. <tr id="i35" class="rowColor">
  539. <td class="colFirst"><code><a href="CtBehavior.html" title="class in javassist">CtBehavior</a></code></td>
  540. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getEnclosingBehavior()">getEnclosingBehavior</a></span>()</code></th>
  541. <td class="colLast">
  542. <div class="block">Returns the immediately enclosing method of this class.</div>
  543. </td>
  544. </tr>
  545. <tr id="i36" class="altColor">
  546. <td class="colFirst"><code><a href="CtMethod.html" title="class in javassist">CtMethod</a></code></td>
  547. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getEnclosingMethod()">getEnclosingMethod</a></span>()</code></th>
  548. <td class="colLast">
  549. <div class="block"><span class="deprecatedLabel">Deprecated.</span>
  550. <div class="deprecationComment">The enclosing method might be a constructor.</div>
  551. </div>
  552. </td>
  553. </tr>
  554. <tr id="i37" class="rowColor">
  555. <td class="colFirst"><code><a href="CtField.html" title="class in javassist">CtField</a></code></td>
  556. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getField(java.lang.String)">getField</a></span>&#8203;(java.lang.String&nbsp;name)</code></th>
  557. <td class="colLast">
  558. <div class="block">Returns the field with the specified name.</div>
  559. </td>
  560. </tr>
  561. <tr id="i38" class="altColor">
  562. <td class="colFirst"><code><a href="CtField.html" title="class in javassist">CtField</a></code></td>
  563. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getField(java.lang.String,java.lang.String)">getField</a></span>&#8203;(java.lang.String&nbsp;name,
  564. java.lang.String&nbsp;desc)</code></th>
  565. <td class="colLast">
  566. <div class="block">Returns the field with the specified name and type.</div>
  567. </td>
  568. </tr>
  569. <tr id="i39" class="rowColor">
  570. <td class="colFirst"><code><a href="CtField.html" title="class in javassist">CtField</a>[]</code></td>
  571. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getFields()">getFields</a></span>()</code></th>
  572. <td class="colLast">
  573. <div class="block">Returns an array containing <code>CtField</code> objects
  574. representing all the non-private fields of the class.</div>
  575. </td>
  576. </tr>
  577. <tr id="i40" class="altColor">
  578. <td class="colFirst"><code>java.lang.String</code></td>
  579. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getGenericSignature()">getGenericSignature</a></span>()</code></th>
  580. <td class="colLast">
  581. <div class="block">Returns the generic signature of the class.</div>
  582. </td>
  583. </tr>
  584. <tr id="i41" class="rowColor">
  585. <td class="colFirst"><code><a href="CtClass.html" title="class in javassist">CtClass</a>[]</code></td>
  586. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getInterfaces()">getInterfaces</a></span>()</code></th>
  587. <td class="colLast">
  588. <div class="block">Obtains the class objects representing the interfaces implemented
  589. by the class or, if this object represents an interface, the interfaces
  590. extended by that interface.</div>
  591. </td>
  592. </tr>
  593. <tr id="i42" class="altColor">
  594. <td class="colFirst"><code><a href="CtMethod.html" title="class in javassist">CtMethod</a></code></td>
  595. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getMethod(java.lang.String,java.lang.String)">getMethod</a></span>&#8203;(java.lang.String&nbsp;name,
  596. java.lang.String&nbsp;desc)</code></th>
  597. <td class="colLast">
  598. <div class="block">Returns the method with the given name and signature.</div>
  599. </td>
  600. </tr>
  601. <tr id="i43" class="rowColor">
  602. <td class="colFirst"><code><a href="CtMethod.html" title="class in javassist">CtMethod</a>[]</code></td>
  603. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getMethods()">getMethods</a></span>()</code></th>
  604. <td class="colLast">
  605. <div class="block">Returns an array containing <code>CtMethod</code> objects
  606. representing all the non-private methods of the class.</div>
  607. </td>
  608. </tr>
  609. <tr id="i44" class="altColor">
  610. <td class="colFirst"><code>int</code></td>
  611. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getModifiers()">getModifiers</a></span>()</code></th>
  612. <td class="colLast">
  613. <div class="block">Returns the modifiers for this class, encoded in an integer.</div>
  614. </td>
  615. </tr>
  616. <tr id="i45" class="rowColor">
  617. <td class="colFirst"><code>java.lang.String</code></td>
  618. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getName()">getName</a></span>()</code></th>
  619. <td class="colLast">
  620. <div class="block">Obtains the fully-qualified name of the class.</div>
  621. </td>
  622. </tr>
  623. <tr id="i46" class="altColor">
  624. <td class="colFirst"><code><a href="CtClass.html" title="class in javassist">CtClass</a>[]</code></td>
  625. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getNestedClasses()">getNestedClasses</a></span>()</code></th>
  626. <td class="colLast">
  627. <div class="block">Returns an array of nested classes declared in the class.</div>
  628. </td>
  629. </tr>
  630. <tr id="i47" class="rowColor">
  631. <td class="colFirst"><code>java.lang.String</code></td>
  632. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getPackageName()">getPackageName</a></span>()</code></th>
  633. <td class="colLast">
  634. <div class="block">Obtains the package name.</div>
  635. </td>
  636. </tr>
  637. <tr id="i48" class="altColor">
  638. <td class="colFirst"><code>java.util.Collection&lt;java.lang.String&gt;</code></td>
  639. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getRefClasses()">getRefClasses</a></span>()</code></th>
  640. <td class="colLast">
  641. <div class="block">Returns a collection of the names of all the classes
  642. referenced in this class.</div>
  643. </td>
  644. </tr>
  645. <tr id="i49" class="rowColor">
  646. <td class="colFirst"><code>java.lang.String</code></td>
  647. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getSimpleName()">getSimpleName</a></span>()</code></th>
  648. <td class="colLast">
  649. <div class="block">Obtains the not-qualified class name.</div>
  650. </td>
  651. </tr>
  652. <tr id="i50" class="altColor">
  653. <td class="colFirst"><code><a href="CtClass.html" title="class in javassist">CtClass</a></code></td>
  654. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getSuperclass()">getSuperclass</a></span>()</code></th>
  655. <td class="colLast">
  656. <div class="block">Obtains the class object representing the superclass of the
  657. class.</div>
  658. </td>
  659. </tr>
  660. <tr id="i51" class="rowColor">
  661. <td class="colFirst"><code>java.net.URL</code></td>
  662. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getURL()">getURL</a></span>()</code></th>
  663. <td class="colLast">
  664. <div class="block">Returns the uniform resource locator (URL) of the class file.</div>
  665. </td>
  666. </tr>
  667. <tr id="i52" class="altColor">
  668. <td class="colFirst"><code>boolean</code></td>
  669. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#hasAnnotation(java.lang.Class)">hasAnnotation</a></span>&#8203;(java.lang.Class&lt;?&gt;&nbsp;annotationType)</code></th>
  670. <td class="colLast">
  671. <div class="block">Returns true if the class has the specified annotation type.</div>
  672. </td>
  673. </tr>
  674. <tr id="i53" class="rowColor">
  675. <td class="colFirst"><code>boolean</code></td>
  676. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#hasAnnotation(java.lang.String)">hasAnnotation</a></span>&#8203;(java.lang.String&nbsp;annotationTypeName)</code></th>
  677. <td class="colLast">
  678. <div class="block">Returns true if the class has the specified annotation type.</div>
  679. </td>
  680. </tr>
  681. <tr id="i54" class="altColor">
  682. <td class="colFirst"><code>void</code></td>
  683. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#instrument(javassist.CodeConverter)">instrument</a></span>&#8203;(<a href="CodeConverter.html" title="class in javassist">CodeConverter</a>&nbsp;converter)</code></th>
  684. <td class="colLast">
  685. <div class="block">Applies the given converter to all methods and constructors
  686. declared in the class.</div>
  687. </td>
  688. </tr>
  689. <tr id="i55" class="rowColor">
  690. <td class="colFirst"><code>void</code></td>
  691. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#instrument(javassist.expr.ExprEditor)">instrument</a></span>&#8203;(<a href="expr/ExprEditor.html" title="class in javassist.expr">ExprEditor</a>&nbsp;editor)</code></th>
  692. <td class="colLast">
  693. <div class="block">Modifies the bodies of all methods and constructors
  694. declared in the class.</div>
  695. </td>
  696. </tr>
  697. <tr id="i56" class="altColor">
  698. <td class="colFirst"><code>boolean</code></td>
  699. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isAnnotation()">isAnnotation</a></span>()</code></th>
  700. <td class="colLast">
  701. <div class="block">Determines whether this object represents an annotation type.</div>
  702. </td>
  703. </tr>
  704. <tr id="i57" class="rowColor">
  705. <td class="colFirst"><code>boolean</code></td>
  706. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isArray()">isArray</a></span>()</code></th>
  707. <td class="colLast">
  708. <div class="block">Returns <code>true</code> if this object represents an array type.</div>
  709. </td>
  710. </tr>
  711. <tr id="i58" class="altColor">
  712. <td class="colFirst"><code>boolean</code></td>
  713. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isEnum()">isEnum</a></span>()</code></th>
  714. <td class="colLast">
  715. <div class="block">Determines whether this object represents an enum.</div>
  716. </td>
  717. </tr>
  718. <tr id="i59" class="rowColor">
  719. <td class="colFirst"><code>boolean</code></td>
  720. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isFrozen()">isFrozen</a></span>()</code></th>
  721. <td class="colLast">
  722. <div class="block">Returns true if the class has been loaded or written out
  723. and thus it cannot be modified any more.</div>
  724. </td>
  725. </tr>
  726. <tr id="i60" class="altColor">
  727. <td class="colFirst"><code>boolean</code></td>
  728. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isInterface()">isInterface</a></span>()</code></th>
  729. <td class="colLast">
  730. <div class="block">Determines whether this object represents a class or an interface.</div>
  731. </td>
  732. </tr>
  733. <tr id="i61" class="rowColor">
  734. <td class="colFirst"><code>boolean</code></td>
  735. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isKotlin()">isKotlin</a></span>()</code></th>
  736. <td class="colLast">
  737. <div class="block">Returns <code>true</code> if this object represents a Kotlin class.</div>
  738. </td>
  739. </tr>
  740. <tr id="i62" class="altColor">
  741. <td class="colFirst"><code>boolean</code></td>
  742. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isModified()">isModified</a></span>()</code></th>
  743. <td class="colLast">
  744. <div class="block">Returns true if the definition of the class has been modified.</div>
  745. </td>
  746. </tr>
  747. <tr id="i63" class="rowColor">
  748. <td class="colFirst"><code>boolean</code></td>
  749. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isPrimitive()">isPrimitive</a></span>()</code></th>
  750. <td class="colLast">
  751. <div class="block">Returns <code>true</code> if this object represents a primitive
  752. Java type: boolean, byte, char, short, int, long, float, double,
  753. or void.</div>
  754. </td>
  755. </tr>
  756. <tr id="i64" class="altColor">
  757. <td class="colFirst"><code>static void</code></td>
  758. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#main(java.lang.String%5B%5D)">main</a></span>&#8203;(java.lang.String[]&nbsp;args)</code></th>
  759. <td class="colLast">
  760. <div class="block">Prints the version number and the copyright notice.</div>
  761. </td>
  762. </tr>
  763. <tr id="i65" class="rowColor">
  764. <td class="colFirst"><code><a href="CtConstructor.html" title="class in javassist">CtConstructor</a></code></td>
  765. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#makeClassInitializer()">makeClassInitializer</a></span>()</code></th>
  766. <td class="colLast">
  767. <div class="block">Makes an empty class initializer (static constructor).</div>
  768. </td>
  769. </tr>
  770. <tr id="i66" class="altColor">
  771. <td class="colFirst"><code><a href="CtClass.html" title="class in javassist">CtClass</a></code></td>
  772. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#makeNestedClass(java.lang.String,boolean)">makeNestedClass</a></span>&#8203;(java.lang.String&nbsp;name,
  773. boolean&nbsp;isStatic)</code></th>
  774. <td class="colLast">
  775. <div class="block">Makes a new public nested class.</div>
  776. </td>
  777. </tr>
  778. <tr id="i67" class="rowColor">
  779. <td class="colFirst"><code>java.lang.String</code></td>
  780. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#makeUniqueName(java.lang.String)">makeUniqueName</a></span>&#8203;(java.lang.String&nbsp;prefix)</code></th>
  781. <td class="colLast">
  782. <div class="block">Makes a unique member name.</div>
  783. </td>
  784. </tr>
  785. <tr id="i68" class="altColor">
  786. <td class="colFirst"><code>void</code></td>
  787. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#prune()">prune</a></span>()</code></th>
  788. <td class="colLast">
  789. <div class="block">Discards unnecessary attributes, in particular,
  790. <code>CodeAttribute</code>s (method bodies) of the class,
  791. to minimize the memory footprint.</div>
  792. </td>
  793. </tr>
  794. <tr id="i69" class="rowColor">
  795. <td class="colFirst"><code>void</code></td>
  796. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#rebuildClassFile()">rebuildClassFile</a></span>()</code></th>
  797. <td class="colLast">
  798. <div class="block">If this method is called, the class file will be
  799. rebuilt when it is finally generated by
  800. <code>toBytecode()</code> and <code>writeFile()</code>.</div>
  801. </td>
  802. </tr>
  803. <tr id="i70" class="altColor">
  804. <td class="colFirst"><code>void</code></td>
  805. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#removeConstructor(javassist.CtConstructor)">removeConstructor</a></span>&#8203;(<a href="CtConstructor.html" title="class in javassist">CtConstructor</a>&nbsp;c)</code></th>
  806. <td class="colLast">
  807. <div class="block">Removes a constructor declared in this class.</div>
  808. </td>
  809. </tr>
  810. <tr id="i71" class="rowColor">
  811. <td class="colFirst"><code>void</code></td>
  812. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#removeField(javassist.CtField)">removeField</a></span>&#8203;(<a href="CtField.html" title="class in javassist">CtField</a>&nbsp;f)</code></th>
  813. <td class="colLast">
  814. <div class="block">Removes a field declared in this class.</div>
  815. </td>
  816. </tr>
  817. <tr id="i72" class="altColor">
  818. <td class="colFirst"><code>void</code></td>
  819. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#removeMethod(javassist.CtMethod)">removeMethod</a></span>&#8203;(<a href="CtMethod.html" title="class in javassist">CtMethod</a>&nbsp;m)</code></th>
  820. <td class="colLast">
  821. <div class="block">Removes a method declared in this class.</div>
  822. </td>
  823. </tr>
  824. <tr id="i73" class="rowColor">
  825. <td class="colFirst"><code>void</code></td>
  826. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#replaceClassName(java.lang.String,java.lang.String)">replaceClassName</a></span>&#8203;(java.lang.String&nbsp;oldName,
  827. java.lang.String&nbsp;newName)</code></th>
  828. <td class="colLast">
  829. <div class="block">Substitutes <code>newName</code> for all occurrences of a class
  830. name <code>oldName</code> in the class file.</div>
  831. </td>
  832. </tr>
  833. <tr id="i74" class="altColor">
  834. <td class="colFirst"><code>void</code></td>
  835. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#replaceClassName(javassist.ClassMap)">replaceClassName</a></span>&#8203;(<a href="ClassMap.html" title="class in javassist">ClassMap</a>&nbsp;map)</code></th>
  836. <td class="colLast">
  837. <div class="block">Changes class names appearing in the class file according to the
  838. given <code>map</code>.</div>
  839. </td>
  840. </tr>
  841. <tr id="i75" class="rowColor">
  842. <td class="colFirst"><code>void</code></td>
  843. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setAttribute(java.lang.String,byte%5B%5D)">setAttribute</a></span>&#8203;(java.lang.String&nbsp;name,
  844. byte[]&nbsp;data)</code></th>
  845. <td class="colLast">
  846. <div class="block">Adds a named attribute.</div>
  847. </td>
  848. </tr>
  849. <tr id="i76" class="altColor">
  850. <td class="colFirst"><code>void</code></td>
  851. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setGenericSignature(java.lang.String)">setGenericSignature</a></span>&#8203;(java.lang.String&nbsp;sig)</code></th>
  852. <td class="colLast">
  853. <div class="block">Sets the generic signature of the class.</div>
  854. </td>
  855. </tr>
  856. <tr id="i77" class="rowColor">
  857. <td class="colFirst"><code>void</code></td>
  858. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setInterfaces(javassist.CtClass%5B%5D)">setInterfaces</a></span>&#8203;(<a href="CtClass.html" title="class in javassist">CtClass</a>[]&nbsp;list)</code></th>
  859. <td class="colLast">
  860. <div class="block">Sets implemented interfaces.</div>
  861. </td>
  862. </tr>
  863. <tr id="i78" class="altColor">
  864. <td class="colFirst"><code>void</code></td>
  865. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setModifiers(int)">setModifiers</a></span>&#8203;(int&nbsp;mod)</code></th>
  866. <td class="colLast">
  867. <div class="block">Sets the modifiers.</div>
  868. </td>
  869. </tr>
  870. <tr id="i79" class="rowColor">
  871. <td class="colFirst"><code>void</code></td>
  872. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setName(java.lang.String)">setName</a></span>&#8203;(java.lang.String&nbsp;name)</code></th>
  873. <td class="colLast">
  874. <div class="block">Sets the class name</div>
  875. </td>
  876. </tr>
  877. <tr id="i80" class="altColor">
  878. <td class="colFirst"><code>void</code></td>
  879. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setSuperclass(javassist.CtClass)">setSuperclass</a></span>&#8203;(<a href="CtClass.html" title="class in javassist">CtClass</a>&nbsp;clazz)</code></th>
  880. <td class="colLast">
  881. <div class="block">Changes a super class unless this object represents an interface.</div>
  882. </td>
  883. </tr>
  884. <tr id="i81" class="rowColor">
  885. <td class="colFirst"><code>boolean</code></td>
  886. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#stopPruning(boolean)">stopPruning</a></span>&#8203;(boolean&nbsp;stop)</code></th>
  887. <td class="colLast">
  888. <div class="block">Disallows (or allows) automatically pruning this <code>CtClass</code>
  889. object.</div>
  890. </td>
  891. </tr>
  892. <tr id="i82" class="altColor">
  893. <td class="colFirst"><code>boolean</code></td>
  894. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#subclassOf(javassist.CtClass)">subclassOf</a></span>&#8203;(<a href="CtClass.html" title="class in javassist">CtClass</a>&nbsp;superclass)</code></th>
  895. <td class="colLast">
  896. <div class="block">Determines whether the class directly or indirectly extends
  897. the given class.</div>
  898. </td>
  899. </tr>
  900. <tr id="i83" class="rowColor">
  901. <td class="colFirst"><code>boolean</code></td>
  902. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#subtypeOf(javassist.CtClass)">subtypeOf</a></span>&#8203;(<a href="CtClass.html" title="class in javassist">CtClass</a>&nbsp;clazz)</code></th>
  903. <td class="colLast">
  904. <div class="block">Returns <code>true</code> if this class extends or implements
  905. <code>clazz</code>.</div>
  906. </td>
  907. </tr>
  908. <tr id="i84" class="altColor">
  909. <td class="colFirst"><code>byte[]</code></td>
  910. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toBytecode()">toBytecode</a></span>()</code></th>
  911. <td class="colLast">
  912. <div class="block">Converts this class to a class file.</div>
  913. </td>
  914. </tr>
  915. <tr id="i85" class="rowColor">
  916. <td class="colFirst"><code>void</code></td>
  917. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toBytecode(java.io.DataOutputStream)">toBytecode</a></span>&#8203;(java.io.DataOutputStream&nbsp;out)</code></th>
  918. <td class="colLast">
  919. <div class="block">Converts this class to a class file.</div>
  920. </td>
  921. </tr>
  922. <tr id="i86" class="altColor">
  923. <td class="colFirst"><code>java.lang.Class&lt;?&gt;</code></td>
  924. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toClass()">toClass</a></span>()</code></th>
  925. <td class="colLast">
  926. <div class="block">Converts this class to a <code>java.lang.Class</code> object.</div>
  927. </td>
  928. </tr>
  929. <tr id="i87" class="rowColor">
  930. <td class="colFirst"><code>java.lang.Class&lt;?&gt;</code></td>
  931. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toClass(java.lang.Class)">toClass</a></span>&#8203;(java.lang.Class&lt;?&gt;&nbsp;neighbor)</code></th>
  932. <td class="colLast">
  933. <div class="block">Converts this class to a <code>java.lang.Class</code> object.</div>
  934. </td>
  935. </tr>
  936. <tr id="i88" class="altColor">
  937. <td class="colFirst"><code>java.lang.Class&lt;?&gt;</code></td>
  938. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toClass(java.lang.ClassLoader)">toClass</a></span>&#8203;(java.lang.ClassLoader&nbsp;loader)</code></th>
  939. <td class="colLast">
  940. <div class="block"><span class="deprecatedLabel">Deprecated.</span>
  941. <div class="deprecationComment">Replaced by <a href="#toClass(java.lang.ClassLoader,java.security.ProtectionDomain)"><code>toClass(ClassLoader,ProtectionDomain)</code></a></div>
  942. </div>
  943. </td>
  944. </tr>
  945. <tr id="i89" class="rowColor">
  946. <td class="colFirst"><code>java.lang.Class&lt;?&gt;</code></td>
  947. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toClass(java.lang.ClassLoader,java.security.ProtectionDomain)">toClass</a></span>&#8203;(java.lang.ClassLoader&nbsp;loader,
  948. java.security.ProtectionDomain&nbsp;domain)</code></th>
  949. <td class="colLast">
  950. <div class="block">Converts this class to a <code>java.lang.Class</code> object.</div>
  951. </td>
  952. </tr>
  953. <tr id="i90" class="altColor">
  954. <td class="colFirst"><code>java.lang.Class&lt;?&gt;</code></td>
  955. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toClass(java.lang.invoke.MethodHandles.Lookup)">toClass</a></span>&#8203;(java.lang.invoke.MethodHandles.Lookup&nbsp;lookup)</code></th>
  956. <td class="colLast">
  957. <div class="block">Converts this class to a <code>java.lang.Class</code> object.</div>
  958. </td>
  959. </tr>
  960. <tr id="i91" class="rowColor">
  961. <td class="colFirst"><code>java.lang.String</code></td>
  962. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toString()">toString</a></span>()</code></th>
  963. <td class="colLast">
  964. <div class="block">Converts the object to a string.</div>
  965. </td>
  966. </tr>
  967. <tr id="i92" class="altColor">
  968. <td class="colFirst"><code>void</code></td>
  969. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#writeFile()">writeFile</a></span>()</code></th>
  970. <td class="colLast">
  971. <div class="block">Writes a class file represented by this <code>CtClass</code>
  972. object in the current directory.</div>
  973. </td>
  974. </tr>
  975. <tr id="i93" class="rowColor">
  976. <td class="colFirst"><code>void</code></td>
  977. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#writeFile(java.lang.String)">writeFile</a></span>&#8203;(java.lang.String&nbsp;directoryName)</code></th>
  978. <td class="colLast">
  979. <div class="block">Writes a class file represented by this <code>CtClass</code>
  980. object on a local disk.</div>
  981. </td>
  982. </tr>
  983. </table>
  984. <ul class="blockList">
  985. <li class="blockList"><a id="methods.inherited.from.class.java.lang.Object">
  986. <!-- -->
  987. </a>
  988. <h3>Methods inherited from class&nbsp;java.lang.Object</h3>
  989. <code>equals, getClass, hashCode, notify, notifyAll, wait, wait, wait</code></li>
  990. </ul>
  991. </li>
  992. </ul>
  993. </section>
  994. </li>
  995. </ul>
  996. </div>
  997. <div class="details">
  998. <ul class="blockList">
  999. <li class="blockList">
  1000. <!-- ============ FIELD DETAIL =========== -->
  1001. <section role="region">
  1002. <ul class="blockList">
  1003. <li class="blockList"><a id="field.detail">
  1004. <!-- -->
  1005. </a>
  1006. <h3>Field Detail</h3>
  1007. <a id="debugDump">
  1008. <!-- -->
  1009. </a>
  1010. <ul class="blockList">
  1011. <li class="blockList">
  1012. <h4>debugDump</h4>
  1013. <pre>public static&nbsp;java.lang.String debugDump</pre>
  1014. <div class="block">If the value of this field is not null, then all class
  1015. files modified by Javassist are saved under the directory
  1016. specified by this variable. For example, if the value is
  1017. <code>"./debug"</code>, then all class files are saved
  1018. there. The directory name must not end with a directory
  1019. separator such as <code>/</code>.
  1020. <p>The default value is null.</div>
  1021. <dl>
  1022. <dt><span class="simpleTagLabel">Since:</span></dt>
  1023. <dd>3.16</dd>
  1024. <dt><span class="seeLabel">See Also:</span></dt>
  1025. <dd><a href="#debugWriteFile(java.lang.String)"><code>debugWriteFile(String)</code></a></dd>
  1026. </dl>
  1027. </li>
  1028. </ul>
  1029. <a id="version">
  1030. <!-- -->
  1031. </a>
  1032. <ul class="blockList">
  1033. <li class="blockList">
  1034. <h4>version</h4>
  1035. <pre>public static final&nbsp;java.lang.String version</pre>
  1036. <div class="block">The version number of this release.</div>
  1037. <dl>
  1038. <dt><span class="seeLabel">See Also:</span></dt>
  1039. <dd><a href="../constant-values.html#javassist.CtClass.version">Constant Field Values</a></dd>
  1040. </dl>
  1041. </li>
  1042. </ul>
  1043. <a id="booleanType">
  1044. <!-- -->
  1045. </a>
  1046. <ul class="blockList">
  1047. <li class="blockList">
  1048. <h4>booleanType</h4>
  1049. <pre>public static&nbsp;<a href="CtClass.html" title="class in javassist">CtClass</a> booleanType</pre>
  1050. <div class="block">The <code>CtClass</code> object representing
  1051. the <code>boolean</code> type.</div>
  1052. </li>
  1053. </ul>
  1054. <a id="charType">
  1055. <!-- -->
  1056. </a>
  1057. <ul class="blockList">
  1058. <li class="blockList">
  1059. <h4>charType</h4>
  1060. <pre>public static&nbsp;<a href="CtClass.html" title="class in javassist">CtClass</a> charType</pre>
  1061. <div class="block">The <code>CtClass</code> object representing
  1062. the <code>char</code> type.</div>
  1063. </li>
  1064. </ul>
  1065. <a id="byteType">
  1066. <!-- -->
  1067. </a>
  1068. <ul class="blockList">
  1069. <li class="blockList">
  1070. <h4>byteType</h4>
  1071. <pre>public static&nbsp;<a href="CtClass.html" title="class in javassist">CtClass</a> byteType</pre>
  1072. <div class="block">The <code>CtClass</code> object representing
  1073. the <code>byte</code> type.</div>
  1074. </li>
  1075. </ul>
  1076. <a id="shortType">
  1077. <!-- -->
  1078. </a>
  1079. <ul class="blockList">
  1080. <li class="blockList">
  1081. <h4>shortType</h4>
  1082. <pre>public static&nbsp;<a href="CtClass.html" title="class in javassist">CtClass</a> shortType</pre>
  1083. <div class="block">The <code>CtClass</code> object representing
  1084. the <code>short</code> type.</div>
  1085. </li>
  1086. </ul>
  1087. <a id="intType">
  1088. <!-- -->
  1089. </a>
  1090. <ul class="blockList">
  1091. <li class="blockList">
  1092. <h4>intType</h4>
  1093. <pre>public static&nbsp;<a href="CtClass.html" title="class in javassist">CtClass</a> intType</pre>
  1094. <div class="block">The <code>CtClass</code> object representing
  1095. the <code>int</code> type.</div>
  1096. </li>
  1097. </ul>
  1098. <a id="longType">
  1099. <!-- -->
  1100. </a>
  1101. <ul class="blockList">
  1102. <li class="blockList">
  1103. <h4>longType</h4>
  1104. <pre>public static&nbsp;<a href="CtClass.html" title="class in javassist">CtClass</a> longType</pre>
  1105. <div class="block">The <code>CtClass</code> object representing
  1106. the <code>long</code> type.</div>
  1107. </li>
  1108. </ul>
  1109. <a id="floatType">
  1110. <!-- -->
  1111. </a>
  1112. <ul class="blockList">
  1113. <li class="blockList">
  1114. <h4>floatType</h4>
  1115. <pre>public static&nbsp;<a href="CtClass.html" title="class in javassist">CtClass</a> floatType</pre>
  1116. <div class="block">The <code>CtClass</code> object representing
  1117. the <code>float</code> type.</div>
  1118. </li>
  1119. </ul>
  1120. <a id="doubleType">
  1121. <!-- -->
  1122. </a>
  1123. <ul class="blockList">
  1124. <li class="blockList">
  1125. <h4>doubleType</h4>
  1126. <pre>public static&nbsp;<a href="CtClass.html" title="class in javassist">CtClass</a> doubleType</pre>
  1127. <div class="block">The <code>CtClass</code> object representing
  1128. the <code>double</code> type.</div>
  1129. </li>
  1130. </ul>
  1131. <a id="voidType">
  1132. <!-- -->
  1133. </a>
  1134. <ul class="blockListLast">
  1135. <li class="blockList">
  1136. <h4>voidType</h4>
  1137. <pre>public static&nbsp;<a href="CtClass.html" title="class in javassist">CtClass</a> voidType</pre>
  1138. <div class="block">The <code>CtClass</code> object representing
  1139. the <code>void</code> type.</div>
  1140. </li>
  1141. </ul>
  1142. </li>
  1143. </ul>
  1144. </section>
  1145. <!-- ============ METHOD DETAIL ========== -->
  1146. <section role="region">
  1147. <ul class="blockList">
  1148. <li class="blockList"><a id="method.detail">
  1149. <!-- -->
  1150. </a>
  1151. <h3>Method Detail</h3>
  1152. <a id="main(java.lang.String[])">
  1153. <!-- -->
  1154. </a>
  1155. <ul class="blockList">
  1156. <li class="blockList">
  1157. <h4>main</h4>
  1158. <pre class="methodSignature">public static&nbsp;void&nbsp;main&#8203;(java.lang.String[]&nbsp;args)</pre>
  1159. <div class="block">Prints the version number and the copyright notice.
  1160. <p>The following command invokes this method:
  1161. <pre>java -jar javassist.jar</pre></div>
  1162. </li>
  1163. </ul>
  1164. <a id="toString()">
  1165. <!-- -->
  1166. </a>
  1167. <ul class="blockList">
  1168. <li class="blockList">
  1169. <h4>toString</h4>
  1170. <pre class="methodSignature">public&nbsp;java.lang.String&nbsp;toString()</pre>
  1171. <div class="block">Converts the object to a string.</div>
  1172. <dl>
  1173. <dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
  1174. <dd><code>toString</code>&nbsp;in class&nbsp;<code>java.lang.Object</code></dd>
  1175. </dl>
  1176. </li>
  1177. </ul>
  1178. <a id="getClassPool()">
  1179. <!-- -->
  1180. </a>
  1181. <ul class="blockList">
  1182. <li class="blockList">
  1183. <h4>getClassPool</h4>
  1184. <pre class="methodSignature">public&nbsp;<a href="ClassPool.html" title="class in javassist">ClassPool</a>&nbsp;getClassPool()</pre>
  1185. <div class="block">Returns a <code>ClassPool</code> for this class.</div>
  1186. </li>
  1187. </ul>
  1188. <a id="getClassFile()">
  1189. <!-- -->
  1190. </a>
  1191. <ul class="blockList">
  1192. <li class="blockList">
  1193. <h4>getClassFile</h4>
  1194. <pre class="methodSignature">public&nbsp;<a href="bytecode/ClassFile.html" title="class in javassist.bytecode">ClassFile</a>&nbsp;getClassFile()</pre>
  1195. <div class="block">Returns a class file for this class.
  1196. <p>This method is not available if <code>isFrozen()</code>
  1197. is true.</div>
  1198. </li>
  1199. </ul>
  1200. <a id="getClassFile2()">
  1201. <!-- -->
  1202. </a>
  1203. <ul class="blockList">
  1204. <li class="blockList">
  1205. <h4>getClassFile2</h4>
  1206. <pre class="methodSignature">public&nbsp;<a href="bytecode/ClassFile.html" title="class in javassist.bytecode">ClassFile</a>&nbsp;getClassFile2()</pre>
  1207. <div class="block">Returns a class file for this class (read only).
  1208. Normal applications do not need calling this method. Use
  1209. <code>getClassFile()</code>.
  1210. <p>The <code>ClassFile</code> object obtained by this method
  1211. is read only. Changes to this object might not be reflected
  1212. on a class file generated by <code>toBytecode()</code>,
  1213. <code>toClass()</code>, etc.
  1214. <p>This method is available even if <code>isFrozen()</code>
  1215. is true. However, if the class is frozen, it might be also
  1216. pruned.</div>
  1217. <dl>
  1218. <dt><span class="seeLabel">See Also:</span></dt>
  1219. <dd><a href="#getClassFile()"><code>getClassFile()</code></a>,
  1220. <a href="#isFrozen()"><code>isFrozen()</code></a>,
  1221. <a href="#prune()"><code>prune()</code></a></dd>
  1222. </dl>
  1223. </li>
  1224. </ul>
  1225. <a id="getAccessorMaker()">
  1226. <!-- -->
  1227. </a>
  1228. <ul class="blockList">
  1229. <li class="blockList">
  1230. <h4>getAccessorMaker</h4>
  1231. <pre class="methodSignature">public&nbsp;javassist.compiler.AccessorMaker&nbsp;getAccessorMaker()</pre>
  1232. <div class="block">Undocumented method. Do not use; internal-use only.</div>
  1233. </li>
  1234. </ul>
  1235. <a id="getURL()">
  1236. <!-- -->
  1237. </a>
  1238. <ul class="blockList">
  1239. <li class="blockList">
  1240. <h4>getURL</h4>
  1241. <pre class="methodSignature">public&nbsp;java.net.URL&nbsp;getURL()
  1242. throws <a href="NotFoundException.html" title="class in javassist">NotFoundException</a></pre>
  1243. <div class="block">Returns the uniform resource locator (URL) of the class file.</div>
  1244. <dl>
  1245. <dt><span class="throwsLabel">Throws:</span></dt>
  1246. <dd><code><a href="NotFoundException.html" title="class in javassist">NotFoundException</a></code></dd>
  1247. </dl>
  1248. </li>
  1249. </ul>
  1250. <a id="isModified()">
  1251. <!-- -->
  1252. </a>
  1253. <ul class="blockList">
  1254. <li class="blockList">
  1255. <h4>isModified</h4>
  1256. <pre class="methodSignature">public&nbsp;boolean&nbsp;isModified()</pre>
  1257. <div class="block">Returns true if the definition of the class has been modified.</div>
  1258. </li>
  1259. </ul>
  1260. <a id="isFrozen()">
  1261. <!-- -->
  1262. </a>
  1263. <ul class="blockList">
  1264. <li class="blockList">
  1265. <h4>isFrozen</h4>
  1266. <pre class="methodSignature">public&nbsp;boolean&nbsp;isFrozen()</pre>
  1267. <div class="block">Returns true if the class has been loaded or written out
  1268. and thus it cannot be modified any more.</div>
  1269. <dl>
  1270. <dt><span class="seeLabel">See Also:</span></dt>
  1271. <dd><a href="#defrost()"><code>defrost()</code></a>,
  1272. <a href="#detach()"><code>detach()</code></a></dd>
  1273. </dl>
  1274. </li>
  1275. </ul>
  1276. <a id="freeze()">
  1277. <!-- -->
  1278. </a>
  1279. <ul class="blockList">
  1280. <li class="blockList">
  1281. <h4>freeze</h4>
  1282. <pre class="methodSignature">public&nbsp;void&nbsp;freeze()</pre>
  1283. <div class="block">Makes the class frozen.</div>
  1284. <dl>
  1285. <dt><span class="simpleTagLabel">Since:</span></dt>
  1286. <dd>3.6</dd>
  1287. <dt><span class="seeLabel">See Also:</span></dt>
  1288. <dd><a href="#isFrozen()"><code>isFrozen()</code></a>,
  1289. <a href="#defrost()"><code>defrost()</code></a></dd>
  1290. </dl>
  1291. </li>
  1292. </ul>
  1293. <a id="defrost()">
  1294. <!-- -->
  1295. </a>
  1296. <ul class="blockList">
  1297. <li class="blockList">
  1298. <h4>defrost</h4>
  1299. <pre class="methodSignature">public&nbsp;void&nbsp;defrost()</pre>
  1300. <div class="block">Defrosts the class so that the class can be modified again.
  1301. <p>To avoid changes that will be never reflected,
  1302. the class is frozen to be unmodifiable if it is loaded or
  1303. written out. This method should be called only in a case
  1304. that the class will be reloaded or written out later again.
  1305. <p>If <code>defrost()</code> will be called later, pruning
  1306. must be disallowed in advance.</div>
  1307. <dl>
  1308. <dt><span class="seeLabel">See Also:</span></dt>
  1309. <dd><a href="#isFrozen()"><code>isFrozen()</code></a>,
  1310. <a href="#stopPruning(boolean)"><code>stopPruning(boolean)</code></a>,
  1311. <a href="#detach()"><code>detach()</code></a></dd>
  1312. </dl>
  1313. </li>
  1314. </ul>
  1315. <a id="isPrimitive()">
  1316. <!-- -->
  1317. </a>
  1318. <ul class="blockList">
  1319. <li class="blockList">
  1320. <h4>isPrimitive</h4>
  1321. <pre class="methodSignature">public&nbsp;boolean&nbsp;isPrimitive()</pre>
  1322. <div class="block">Returns <code>true</code> if this object represents a primitive
  1323. Java type: boolean, byte, char, short, int, long, float, double,
  1324. or void.</div>
  1325. </li>
  1326. </ul>
  1327. <a id="isArray()">
  1328. <!-- -->
  1329. </a>
  1330. <ul class="blockList">
  1331. <li class="blockList">
  1332. <h4>isArray</h4>
  1333. <pre class="methodSignature">public&nbsp;boolean&nbsp;isArray()</pre>
  1334. <div class="block">Returns <code>true</code> if this object represents an array type.</div>
  1335. </li>
  1336. </ul>
  1337. <a id="isKotlin()">
  1338. <!-- -->
  1339. </a>
  1340. <ul class="blockList">
  1341. <li class="blockList">
  1342. <h4>isKotlin</h4>
  1343. <pre class="methodSignature">public&nbsp;boolean&nbsp;isKotlin()</pre>
  1344. <div class="block">Returns <code>true</code> if this object represents a Kotlin class.</div>
  1345. <dl>
  1346. <dt><span class="simpleTagLabel">Since:</span></dt>
  1347. <dd>3.26</dd>
  1348. </dl>
  1349. </li>
  1350. </ul>
  1351. <a id="getComponentType()">
  1352. <!-- -->
  1353. </a>
  1354. <ul class="blockList">
  1355. <li class="blockList">
  1356. <h4>getComponentType</h4>
  1357. <pre class="methodSignature">public&nbsp;<a href="CtClass.html" title="class in javassist">CtClass</a>&nbsp;getComponentType()
  1358. throws <a href="NotFoundException.html" title="class in javassist">NotFoundException</a></pre>
  1359. <div class="block">If this object represents an array, this method returns the component
  1360. type of the array. Otherwise, it returns <code>null</code>.</div>
  1361. <dl>
  1362. <dt><span class="throwsLabel">Throws:</span></dt>
  1363. <dd><code><a href="NotFoundException.html" title="class in javassist">NotFoundException</a></code></dd>
  1364. </dl>
  1365. </li>
  1366. </ul>
  1367. <a id="subtypeOf(javassist.CtClass)">
  1368. <!-- -->
  1369. </a>
  1370. <ul class="blockList">
  1371. <li class="blockList">
  1372. <h4>subtypeOf</h4>
  1373. <pre class="methodSignature">public&nbsp;boolean&nbsp;subtypeOf&#8203;(<a href="CtClass.html" title="class in javassist">CtClass</a>&nbsp;clazz)
  1374. throws <a href="NotFoundException.html" title="class in javassist">NotFoundException</a></pre>
  1375. <div class="block">Returns <code>true</code> if this class extends or implements
  1376. <code>clazz</code>. It also returns <code>true</code> if
  1377. this class is the same as <code>clazz</code>.</div>
  1378. <dl>
  1379. <dt><span class="throwsLabel">Throws:</span></dt>
  1380. <dd><code><a href="NotFoundException.html" title="class in javassist">NotFoundException</a></code></dd>
  1381. </dl>
  1382. </li>
  1383. </ul>
  1384. <a id="getName()">
  1385. <!-- -->
  1386. </a>
  1387. <ul class="blockList">
  1388. <li class="blockList">
  1389. <h4>getName</h4>
  1390. <pre class="methodSignature">public&nbsp;java.lang.String&nbsp;getName()</pre>
  1391. <div class="block">Obtains the fully-qualified name of the class.</div>
  1392. </li>
  1393. </ul>
  1394. <a id="getSimpleName()">
  1395. <!-- -->
  1396. </a>
  1397. <ul class="blockList">
  1398. <li class="blockList">
  1399. <h4>getSimpleName</h4>
  1400. <pre class="methodSignature">public final&nbsp;java.lang.String&nbsp;getSimpleName()</pre>
  1401. <div class="block">Obtains the not-qualified class name.</div>
  1402. </li>
  1403. </ul>
  1404. <a id="getPackageName()">
  1405. <!-- -->
  1406. </a>
  1407. <ul class="blockList">
  1408. <li class="blockList">
  1409. <h4>getPackageName</h4>
  1410. <pre class="methodSignature">public final&nbsp;java.lang.String&nbsp;getPackageName()</pre>
  1411. <div class="block">Obtains the package name. It may be <code>null</code>.</div>
  1412. </li>
  1413. </ul>
  1414. <a id="setName(java.lang.String)">
  1415. <!-- -->
  1416. </a>
  1417. <ul class="blockList">
  1418. <li class="blockList">
  1419. <h4>setName</h4>
  1420. <pre class="methodSignature">public&nbsp;void&nbsp;setName&#8203;(java.lang.String&nbsp;name)</pre>
  1421. <div class="block">Sets the class name</div>
  1422. <dl>
  1423. <dt><span class="paramLabel">Parameters:</span></dt>
  1424. <dd><code>name</code> - fully-qualified name</dd>
  1425. </dl>
  1426. </li>
  1427. </ul>
  1428. <a id="getGenericSignature()">
  1429. <!-- -->
  1430. </a>
  1431. <ul class="blockList">
  1432. <li class="blockList">
  1433. <h4>getGenericSignature</h4>
  1434. <pre class="methodSignature">public&nbsp;java.lang.String&nbsp;getGenericSignature()</pre>
  1435. <div class="block">Returns the generic signature of the class.
  1436. <p>The generics of Java is implemented by the erasure technique.
  1437. After compilation, all type parameters are dropped off from the
  1438. main part of a class file. However, for reflection, the type
  1439. parameters are encoded into generic signatures and attached
  1440. to a class file.</div>
  1441. <dl>
  1442. <dt><span class="returnLabel">Returns:</span></dt>
  1443. <dd>null if the generic signature is not included.</dd>
  1444. <dt><span class="simpleTagLabel">Since:</span></dt>
  1445. <dd>3.17</dd>
  1446. <dt><span class="seeLabel">See Also:</span></dt>
  1447. <dd><a href="bytecode/SignatureAttribute.html#toClassSignature(java.lang.String)"><code>SignatureAttribute.toClassSignature(String)</code></a>,
  1448. <a href="CtMember.html#getGenericSignature()"><code>CtMember.getGenericSignature()</code></a></dd>
  1449. </dl>
  1450. </li>
  1451. </ul>
  1452. <a id="setGenericSignature(java.lang.String)">
  1453. <!-- -->
  1454. </a>
  1455. <ul class="blockList">
  1456. <li class="blockList">
  1457. <h4>setGenericSignature</h4>
  1458. <pre class="methodSignature">public&nbsp;void&nbsp;setGenericSignature&#8203;(java.lang.String&nbsp;sig)</pre>
  1459. <div class="block">Sets the generic signature of the class.
  1460. <p>The generics of Java is implemented by the erasure technique.
  1461. After compilation, all type parameters are dropped off from the
  1462. main part of a class file. However, for reflection, the type
  1463. parameters must be encoded into generic signatures and attached
  1464. to a class file.
  1465. <p>For example,
  1466. <pre>class List&lt;T&gt; {
  1467. T value;
  1468. T get() { return value; }
  1469. void set(T v) { value = v; }
  1470. }
  1471. </pre>
  1472. <p>this class is generated by the following code:
  1473. <pre>
  1474. ClassPool pool = ClassPool.getDefault();
  1475. CtClass cc = pool.makeClass("List");
  1476. CtClass objectClass = pool.get(CtClass.javaLangObject);
  1477. ClassSignature cs = new ClassSignature(
  1478. new TypeParameter[] { new TypeParameter("T") });
  1479. cc.setGenericSignature(cs.encode()); // &lt;T:Ljava/lang/Object;&gt;Ljava/lang/Object;
  1480. CtField f = new CtField(objClass, "value", cc);
  1481. TypeVariable tvar = new TypeVariable("T");
  1482. f.setGenericSignature(tvar.encode()); // TT;
  1483. cc.addField(f);
  1484. CtMethod m = CtNewMethod.make("public Object get(){return value;}", cc);
  1485. MethodSignature ms = new MethodSignature(null, null, tvar, null);
  1486. m.setGenericSignature(ms.encode()); // ()TT;
  1487. cc.addMethod(m);
  1488. CtMethod m2 = CtNewMethod.make("public void set(Object v){value = v;}", cc);
  1489. MethodSignature ms2 = new MethodSignature(null, new Type[] { tvar },
  1490. new BaseType("void"), null);
  1491. m2.setGenericSignature(ms2.encode()); // (TT;)V;
  1492. cc.addMethod(m2);
  1493. cc.writeFile();
  1494. </pre>
  1495. <p>The generated class file is equivalent to the following:
  1496. <pre>class List {
  1497. Object value;
  1498. Object get() { return value; }
  1499. void set(Object v) { value = v; }
  1500. }</pre>
  1501. <p>but it includes generic signatures for the class, the field,
  1502. and the methods so that the type variable <code>T</code> can be
  1503. accessible through reflection.
  1504. <p><code>MethodSignature</code> is a utility class. You can directly
  1505. pass the signature string to the <code>setGenericSignature</code> method.
  1506. For the specification of the signatures, see Section 4.7.9.1 <i>Signatures</i>
  1507. of The Java Virtual Machine Specification (Java SE 8).</div>
  1508. <dl>
  1509. <dt><span class="paramLabel">Parameters:</span></dt>
  1510. <dd><code>sig</code> - a generic signature.</dd>
  1511. <dt><span class="simpleTagLabel">Since:</span></dt>
  1512. <dd>3.17</dd>
  1513. <dt><span class="seeLabel">See Also:</span></dt>
  1514. <dd><a href="bytecode/SignatureAttribute.ClassSignature.html#encode()"><code>SignatureAttribute.ClassSignature.encode()</code></a>,
  1515. <a href="bytecode/SignatureAttribute.MethodSignature.html#encode()"><code>SignatureAttribute.MethodSignature.encode()</code></a>,
  1516. <a href="CtMember.html#setGenericSignature(java.lang.String)"><code>CtMember.setGenericSignature(String)</code></a></dd>
  1517. </dl>
  1518. </li>
  1519. </ul>
  1520. <a id="replaceClassName(java.lang.String,java.lang.String)">
  1521. <!-- -->
  1522. </a>
  1523. <ul class="blockList">
  1524. <li class="blockList">
  1525. <h4>replaceClassName</h4>
  1526. <pre class="methodSignature">public&nbsp;void&nbsp;replaceClassName&#8203;(java.lang.String&nbsp;oldName,
  1527. java.lang.String&nbsp;newName)</pre>
  1528. <div class="block">Substitutes <code>newName</code> for all occurrences of a class
  1529. name <code>oldName</code> in the class file.</div>
  1530. <dl>
  1531. <dt><span class="paramLabel">Parameters:</span></dt>
  1532. <dd><code>oldName</code> - replaced class name</dd>
  1533. <dd><code>newName</code> - substituted class name</dd>
  1534. </dl>
  1535. </li>
  1536. </ul>
  1537. <a id="replaceClassName(javassist.ClassMap)">
  1538. <!-- -->
  1539. </a>
  1540. <ul class="blockList">
  1541. <li class="blockList">
  1542. <h4>replaceClassName</h4>
  1543. <pre class="methodSignature">public&nbsp;void&nbsp;replaceClassName&#8203;(<a href="ClassMap.html" title="class in javassist">ClassMap</a>&nbsp;map)</pre>
  1544. <div class="block">Changes class names appearing in the class file according to the
  1545. given <code>map</code>.
  1546. <p>All the class names appearing in the class file are tested
  1547. with <code>map</code> to determine whether each class name is
  1548. replaced or not. Thus this method can be used for collecting
  1549. all the class names in the class file. To do that, first define
  1550. a subclass of <code>ClassMap</code> so that <code>get()</code>
  1551. records all the given parameters. Then, make an instance of
  1552. that subclass as an empty hash-table. Finally, pass that instance
  1553. to this method. After this method finishes, that instance would
  1554. contain all the class names appearing in the class file.</div>
  1555. <dl>
  1556. <dt><span class="paramLabel">Parameters:</span></dt>
  1557. <dd><code>map</code> - the hashtable associating replaced class names
  1558. with substituted names.</dd>
  1559. </dl>
  1560. </li>
  1561. </ul>
  1562. <a id="getRefClasses()">
  1563. <!-- -->
  1564. </a>
  1565. <ul class="blockList">
  1566. <li class="blockList">
  1567. <h4>getRefClasses</h4>
  1568. <pre class="methodSignature">public&nbsp;java.util.Collection&lt;java.lang.String&gt;&nbsp;getRefClasses()</pre>
  1569. <div class="block">Returns a collection of the names of all the classes
  1570. referenced in this class.
  1571. That collection includes the name of this class.
  1572. <p>This method may return <code>null</code>.</div>
  1573. <dl>
  1574. <dt><span class="returnLabel">Returns:</span></dt>
  1575. <dd>a <code>Collection&lt;String&gt;</code> object.</dd>
  1576. </dl>
  1577. </li>
  1578. </ul>
  1579. <a id="isInterface()">
  1580. <!-- -->
  1581. </a>
  1582. <ul class="blockList">
  1583. <li class="blockList">
  1584. <h4>isInterface</h4>
  1585. <pre class="methodSignature">public&nbsp;boolean&nbsp;isInterface()</pre>
  1586. <div class="block">Determines whether this object represents a class or an interface.
  1587. It returns <code>true</code> if this object represents an interface.</div>
  1588. </li>
  1589. </ul>
  1590. <a id="isAnnotation()">
  1591. <!-- -->
  1592. </a>
  1593. <ul class="blockList">
  1594. <li class="blockList">
  1595. <h4>isAnnotation</h4>
  1596. <pre class="methodSignature">public&nbsp;boolean&nbsp;isAnnotation()</pre>
  1597. <div class="block">Determines whether this object represents an annotation type.
  1598. It returns <code>true</code> if this object represents an annotation type.</div>
  1599. <dl>
  1600. <dt><span class="simpleTagLabel">Since:</span></dt>
  1601. <dd>3.2</dd>
  1602. </dl>
  1603. </li>
  1604. </ul>
  1605. <a id="isEnum()">
  1606. <!-- -->
  1607. </a>
  1608. <ul class="blockList">
  1609. <li class="blockList">
  1610. <h4>isEnum</h4>
  1611. <pre class="methodSignature">public&nbsp;boolean&nbsp;isEnum()</pre>
  1612. <div class="block">Determines whether this object represents an enum.
  1613. It returns <code>true</code> if this object represents an enum.</div>
  1614. <dl>
  1615. <dt><span class="simpleTagLabel">Since:</span></dt>
  1616. <dd>3.2</dd>
  1617. </dl>
  1618. </li>
  1619. </ul>
  1620. <a id="getModifiers()">
  1621. <!-- -->
  1622. </a>
  1623. <ul class="blockList">
  1624. <li class="blockList">
  1625. <h4>getModifiers</h4>
  1626. <pre class="methodSignature">public&nbsp;int&nbsp;getModifiers()</pre>
  1627. <div class="block">Returns the modifiers for this class, encoded in an integer.
  1628. For decoding, use <code>javassist.Modifier</code>.
  1629. <p>If the class is a static nested class (a.k.a. static inner class),
  1630. the returned modifiers include <code>Modifier.STATIC</code>.</div>
  1631. <dl>
  1632. <dt><span class="seeLabel">See Also:</span></dt>
  1633. <dd><a href="Modifier.html" title="class in javassist"><code>Modifier</code></a></dd>
  1634. </dl>
  1635. </li>
  1636. </ul>
  1637. <a id="hasAnnotation(java.lang.Class)">
  1638. <!-- -->
  1639. </a>
  1640. <ul class="blockList">
  1641. <li class="blockList">
  1642. <h4>hasAnnotation</h4>
  1643. <pre class="methodSignature">public&nbsp;boolean&nbsp;hasAnnotation&#8203;(java.lang.Class&lt;?&gt;&nbsp;annotationType)</pre>
  1644. <div class="block">Returns true if the class has the specified annotation type.</div>
  1645. <dl>
  1646. <dt><span class="paramLabel">Parameters:</span></dt>
  1647. <dd><code>annotationType</code> - the annotation type.</dd>
  1648. <dt><span class="returnLabel">Returns:</span></dt>
  1649. <dd><code>true</code> if the annotation is found, otherwise <code>false</code>.</dd>
  1650. <dt><span class="simpleTagLabel">Since:</span></dt>
  1651. <dd>3.11</dd>
  1652. </dl>
  1653. </li>
  1654. </ul>
  1655. <a id="hasAnnotation(java.lang.String)">
  1656. <!-- -->
  1657. </a>
  1658. <ul class="blockList">
  1659. <li class="blockList">
  1660. <h4>hasAnnotation</h4>
  1661. <pre class="methodSignature">public&nbsp;boolean&nbsp;hasAnnotation&#8203;(java.lang.String&nbsp;annotationTypeName)</pre>
  1662. <div class="block">Returns true if the class has the specified annotation type.</div>
  1663. <dl>
  1664. <dt><span class="paramLabel">Parameters:</span></dt>
  1665. <dd><code>annotationTypeName</code> - the name of annotation type.</dd>
  1666. <dt><span class="returnLabel">Returns:</span></dt>
  1667. <dd><code>true</code> if the annotation is found, otherwise <code>false</code>.</dd>
  1668. <dt><span class="simpleTagLabel">Since:</span></dt>
  1669. <dd>3.21</dd>
  1670. </dl>
  1671. </li>
  1672. </ul>
  1673. <a id="getAnnotation(java.lang.Class)">
  1674. <!-- -->
  1675. </a>
  1676. <ul class="blockList">
  1677. <li class="blockList">
  1678. <h4>getAnnotation</h4>
  1679. <pre class="methodSignature">public&nbsp;java.lang.Object&nbsp;getAnnotation&#8203;(java.lang.Class&lt;?&gt;&nbsp;clz)
  1680. throws java.lang.ClassNotFoundException</pre>
  1681. <div class="block">Returns the annotation if the class has the specified annotation type.
  1682. For example, if an annotation <code>@Author</code> is associated
  1683. with this class, an <code>Author</code> object is returned.
  1684. The member values can be obtained by calling methods on
  1685. the <code>Author</code> object.</div>
  1686. <dl>
  1687. <dt><span class="paramLabel">Parameters:</span></dt>
  1688. <dd><code>clz</code> - the annotation type.</dd>
  1689. <dt><span class="returnLabel">Returns:</span></dt>
  1690. <dd>the annotation if found, otherwise <code>null</code>.</dd>
  1691. <dt><span class="throwsLabel">Throws:</span></dt>
  1692. <dd><code>java.lang.ClassNotFoundException</code></dd>
  1693. <dt><span class="simpleTagLabel">Since:</span></dt>
  1694. <dd>3.11</dd>
  1695. </dl>
  1696. </li>
  1697. </ul>
  1698. <a id="getAnnotations()">
  1699. <!-- -->
  1700. </a>
  1701. <ul class="blockList">
  1702. <li class="blockList">
  1703. <h4>getAnnotations</h4>
  1704. <pre class="methodSignature">public&nbsp;java.lang.Object[]&nbsp;getAnnotations()
  1705. throws java.lang.ClassNotFoundException</pre>
  1706. <div class="block">Returns the annotations associated with this class.
  1707. For example, if an annotation <code>@Author</code> is associated
  1708. with this class, the returned array contains an <code>Author</code>
  1709. object. The member values can be obtained by calling methods on
  1710. the <code>Author</code> object.</div>
  1711. <dl>
  1712. <dt><span class="returnLabel">Returns:</span></dt>
  1713. <dd>an array of annotation-type objects.</dd>
  1714. <dt><span class="throwsLabel">Throws:</span></dt>
  1715. <dd><code>java.lang.ClassNotFoundException</code></dd>
  1716. <dt><span class="simpleTagLabel">Since:</span></dt>
  1717. <dd>3.1</dd>
  1718. <dt><span class="seeLabel">See Also:</span></dt>
  1719. <dd><a href="CtMember.html#getAnnotations()"><code>CtMember.getAnnotations()</code></a></dd>
  1720. </dl>
  1721. </li>
  1722. </ul>
  1723. <a id="getAvailableAnnotations()">
  1724. <!-- -->
  1725. </a>
  1726. <ul class="blockList">
  1727. <li class="blockList">
  1728. <h4>getAvailableAnnotations</h4>
  1729. <pre class="methodSignature">public&nbsp;java.lang.Object[]&nbsp;getAvailableAnnotations()</pre>
  1730. <div class="block">Returns the annotations associated with this class.
  1731. This method is equivalent to <code>getAnnotations()</code>
  1732. except that, if any annotations are not on the classpath,
  1733. they are not included in the returned array.</div>
  1734. <dl>
  1735. <dt><span class="returnLabel">Returns:</span></dt>
  1736. <dd>an array of annotation-type objects.</dd>
  1737. <dt><span class="simpleTagLabel">Since:</span></dt>
  1738. <dd>3.3</dd>
  1739. <dt><span class="seeLabel">See Also:</span></dt>
  1740. <dd><a href="#getAnnotations()"><code>getAnnotations()</code></a>,
  1741. <a href="CtMember.html#getAvailableAnnotations()"><code>CtMember.getAvailableAnnotations()</code></a></dd>
  1742. </dl>
  1743. </li>
  1744. </ul>
  1745. <a id="getDeclaredClasses()">
  1746. <!-- -->
  1747. </a>
  1748. <ul class="blockList">
  1749. <li class="blockList">
  1750. <h4>getDeclaredClasses</h4>
  1751. <pre class="methodSignature">public&nbsp;<a href="CtClass.html" title="class in javassist">CtClass</a>[]&nbsp;getDeclaredClasses()
  1752. throws <a href="NotFoundException.html" title="class in javassist">NotFoundException</a></pre>
  1753. <div class="block">Returns an array of nested classes declared in the class.
  1754. Nested classes are inner classes, anonymous classes, local classes,
  1755. and static nested classes. This simply calls <code>getNestedClasses()</code>.</div>
  1756. <dl>
  1757. <dt><span class="throwsLabel">Throws:</span></dt>
  1758. <dd><code><a href="NotFoundException.html" title="class in javassist">NotFoundException</a></code></dd>
  1759. <dt><span class="simpleTagLabel">Since:</span></dt>
  1760. <dd>3.15</dd>
  1761. <dt><span class="seeLabel">See Also:</span></dt>
  1762. <dd><a href="#getNestedClasses()"><code>getNestedClasses()</code></a></dd>
  1763. </dl>
  1764. </li>
  1765. </ul>
  1766. <a id="getNestedClasses()">
  1767. <!-- -->
  1768. </a>
  1769. <ul class="blockList">
  1770. <li class="blockList">
  1771. <h4>getNestedClasses</h4>
  1772. <pre class="methodSignature">public&nbsp;<a href="CtClass.html" title="class in javassist">CtClass</a>[]&nbsp;getNestedClasses()
  1773. throws <a href="NotFoundException.html" title="class in javassist">NotFoundException</a></pre>
  1774. <div class="block">Returns an array of nested classes declared in the class.
  1775. Nested classes are inner classes, anonymous classes, local classes,
  1776. and static nested classes.</div>
  1777. <dl>
  1778. <dt><span class="throwsLabel">Throws:</span></dt>
  1779. <dd><code><a href="NotFoundException.html" title="class in javassist">NotFoundException</a></code></dd>
  1780. <dt><span class="simpleTagLabel">Since:</span></dt>
  1781. <dd>3.2</dd>
  1782. </dl>
  1783. </li>
  1784. </ul>
  1785. <a id="setModifiers(int)">
  1786. <!-- -->
  1787. </a>
  1788. <ul class="blockList">
  1789. <li class="blockList">
  1790. <h4>setModifiers</h4>
  1791. <pre class="methodSignature">public&nbsp;void&nbsp;setModifiers&#8203;(int&nbsp;mod)</pre>
  1792. <div class="block">Sets the modifiers.
  1793. <p>If the class is a nested class, this method also modifies
  1794. the class declaring that nested class (i.e. the enclosing
  1795. class is modified).</div>
  1796. <dl>
  1797. <dt><span class="paramLabel">Parameters:</span></dt>
  1798. <dd><code>mod</code> - modifiers encoded by
  1799. <code>javassist.Modifier</code></dd>
  1800. <dt><span class="seeLabel">See Also:</span></dt>
  1801. <dd><a href="Modifier.html" title="class in javassist"><code>Modifier</code></a></dd>
  1802. </dl>
  1803. </li>
  1804. </ul>
  1805. <a id="subclassOf(javassist.CtClass)">
  1806. <!-- -->
  1807. </a>
  1808. <ul class="blockList">
  1809. <li class="blockList">
  1810. <h4>subclassOf</h4>
  1811. <pre class="methodSignature">public&nbsp;boolean&nbsp;subclassOf&#8203;(<a href="CtClass.html" title="class in javassist">CtClass</a>&nbsp;superclass)</pre>
  1812. <div class="block">Determines whether the class directly or indirectly extends
  1813. the given class. If this class extends a class A and
  1814. the class A extends a class B, then subclassof(B) returns true.
  1815. <p>This method returns true if the given class is identical to
  1816. the class represented by this object.</div>
  1817. </li>
  1818. </ul>
  1819. <a id="getSuperclass()">
  1820. <!-- -->
  1821. </a>
  1822. <ul class="blockList">
  1823. <li class="blockList">
  1824. <h4>getSuperclass</h4>
  1825. <pre class="methodSignature">public&nbsp;<a href="CtClass.html" title="class in javassist">CtClass</a>&nbsp;getSuperclass()
  1826. throws <a href="NotFoundException.html" title="class in javassist">NotFoundException</a></pre>
  1827. <div class="block">Obtains the class object representing the superclass of the
  1828. class.
  1829. It returns null if this object represents the
  1830. <code>java.lang.Object</code> class and thus it does not have
  1831. the super class.
  1832. <p>If this object represents an interface, this method
  1833. always returns the <code>java.lang.Object</code> class.
  1834. To obtain the super interfaces
  1835. extended by that interface, call <code>getInterfaces()</code>.</div>
  1836. <dl>
  1837. <dt><span class="throwsLabel">Throws:</span></dt>
  1838. <dd><code><a href="NotFoundException.html" title="class in javassist">NotFoundException</a></code></dd>
  1839. </dl>
  1840. </li>
  1841. </ul>
  1842. <a id="setSuperclass(javassist.CtClass)">
  1843. <!-- -->
  1844. </a>
  1845. <ul class="blockList">
  1846. <li class="blockList">
  1847. <h4>setSuperclass</h4>
  1848. <pre class="methodSignature">public&nbsp;void&nbsp;setSuperclass&#8203;(<a href="CtClass.html" title="class in javassist">CtClass</a>&nbsp;clazz)
  1849. throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
  1850. <div class="block">Changes a super class unless this object represents an interface.
  1851. The new super class must be compatible with the old one; for example,
  1852. it should inherit from the old super class.
  1853. <p>If this object represents an interface, this method is equivalent
  1854. to <code>addInterface()</code>; it appends <code>clazz</code> to
  1855. the list of the super interfaces extended by that interface.
  1856. Note that an interface can extend multiple super interfaces.</div>
  1857. <dl>
  1858. <dt><span class="throwsLabel">Throws:</span></dt>
  1859. <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
  1860. <dt><span class="seeLabel">See Also:</span></dt>
  1861. <dd><a href="#replaceClassName(java.lang.String,java.lang.String)"><code>replaceClassName(String, String)</code></a>,
  1862. <a href="#replaceClassName(javassist.ClassMap)"><code>replaceClassName(ClassMap)</code></a></dd>
  1863. </dl>
  1864. </li>
  1865. </ul>
  1866. <a id="getInterfaces()">
  1867. <!-- -->
  1868. </a>
  1869. <ul class="blockList">
  1870. <li class="blockList">
  1871. <h4>getInterfaces</h4>
  1872. <pre class="methodSignature">public&nbsp;<a href="CtClass.html" title="class in javassist">CtClass</a>[]&nbsp;getInterfaces()
  1873. throws <a href="NotFoundException.html" title="class in javassist">NotFoundException</a></pre>
  1874. <div class="block">Obtains the class objects representing the interfaces implemented
  1875. by the class or, if this object represents an interface, the interfaces
  1876. extended by that interface.</div>
  1877. <dl>
  1878. <dt><span class="throwsLabel">Throws:</span></dt>
  1879. <dd><code><a href="NotFoundException.html" title="class in javassist">NotFoundException</a></code></dd>
  1880. </dl>
  1881. </li>
  1882. </ul>
  1883. <a id="setInterfaces(javassist.CtClass[])">
  1884. <!-- -->
  1885. </a>
  1886. <ul class="blockList">
  1887. <li class="blockList">
  1888. <h4>setInterfaces</h4>
  1889. <pre class="methodSignature">public&nbsp;void&nbsp;setInterfaces&#8203;(<a href="CtClass.html" title="class in javassist">CtClass</a>[]&nbsp;list)</pre>
  1890. <div class="block">Sets implemented interfaces. If this object represents an interface,
  1891. this method sets the interfaces extended by that interface.</div>
  1892. <dl>
  1893. <dt><span class="paramLabel">Parameters:</span></dt>
  1894. <dd><code>list</code> - a list of the <code>CtClass</code> objects
  1895. representing interfaces, or
  1896. <code>null</code> if the class implements
  1897. no interfaces.</dd>
  1898. </dl>
  1899. </li>
  1900. </ul>
  1901. <a id="addInterface(javassist.CtClass)">
  1902. <!-- -->
  1903. </a>
  1904. <ul class="blockList">
  1905. <li class="blockList">
  1906. <h4>addInterface</h4>
  1907. <pre class="methodSignature">public&nbsp;void&nbsp;addInterface&#8203;(<a href="CtClass.html" title="class in javassist">CtClass</a>&nbsp;anInterface)</pre>
  1908. <div class="block">Adds an interface.</div>
  1909. <dl>
  1910. <dt><span class="paramLabel">Parameters:</span></dt>
  1911. <dd><code>anInterface</code> - the added interface.</dd>
  1912. </dl>
  1913. </li>
  1914. </ul>
  1915. <a id="getDeclaringClass()">
  1916. <!-- -->
  1917. </a>
  1918. <ul class="blockList">
  1919. <li class="blockList">
  1920. <h4>getDeclaringClass</h4>
  1921. <pre class="methodSignature">public&nbsp;<a href="CtClass.html" title="class in javassist">CtClass</a>&nbsp;getDeclaringClass()
  1922. throws <a href="NotFoundException.html" title="class in javassist">NotFoundException</a></pre>
  1923. <div class="block">If this class is a member class or interface of another class,
  1924. then the class enclosing this class is returned.</div>
  1925. <dl>
  1926. <dt><span class="returnLabel">Returns:</span></dt>
  1927. <dd>null if this class is a top-level class or an anonymous class.</dd>
  1928. <dt><span class="throwsLabel">Throws:</span></dt>
  1929. <dd><code><a href="NotFoundException.html" title="class in javassist">NotFoundException</a></code></dd>
  1930. </dl>
  1931. </li>
  1932. </ul>
  1933. <a id="getEnclosingMethod()">
  1934. <!-- -->
  1935. </a>
  1936. <ul class="blockList">
  1937. <li class="blockList">
  1938. <h4>getEnclosingMethod</h4>
  1939. <pre class="methodSignature">@Deprecated
  1940. public final&nbsp;<a href="CtMethod.html" title="class in javassist">CtMethod</a>&nbsp;getEnclosingMethod()
  1941. throws <a href="NotFoundException.html" title="class in javassist">NotFoundException</a></pre>
  1942. <div class="deprecationBlock"><span class="deprecatedLabel">Deprecated.</span>
  1943. <div class="deprecationComment">The enclosing method might be a constructor.
  1944. Use <a href="#getEnclosingBehavior()"><code>getEnclosingBehavior()</code></a>.</div>
  1945. </div>
  1946. <div class="block">Returns the immediately enclosing method of this class.
  1947. This method works only with JDK 1.5 or later.</div>
  1948. <dl>
  1949. <dt><span class="returnLabel">Returns:</span></dt>
  1950. <dd>null if this class is not a local class or an anonymous
  1951. class.</dd>
  1952. <dt><span class="throwsLabel">Throws:</span></dt>
  1953. <dd><code><a href="NotFoundException.html" title="class in javassist">NotFoundException</a></code></dd>
  1954. <dt><span class="seeLabel">See Also:</span></dt>
  1955. <dd><a href="#getEnclosingBehavior()"><code>getEnclosingBehavior()</code></a></dd>
  1956. </dl>
  1957. </li>
  1958. </ul>
  1959. <a id="getEnclosingBehavior()">
  1960. <!-- -->
  1961. </a>
  1962. <ul class="blockList">
  1963. <li class="blockList">
  1964. <h4>getEnclosingBehavior</h4>
  1965. <pre class="methodSignature">public&nbsp;<a href="CtBehavior.html" title="class in javassist">CtBehavior</a>&nbsp;getEnclosingBehavior()
  1966. throws <a href="NotFoundException.html" title="class in javassist">NotFoundException</a></pre>
  1967. <div class="block">Returns the immediately enclosing method of this class.
  1968. It might be not a method but a constructor.
  1969. This method works only with JDK 1.5 or later.</div>
  1970. <dl>
  1971. <dt><span class="returnLabel">Returns:</span></dt>
  1972. <dd>null if this class is not a local class or an anonymous
  1973. class.</dd>
  1974. <dt><span class="throwsLabel">Throws:</span></dt>
  1975. <dd><code><a href="NotFoundException.html" title="class in javassist">NotFoundException</a></code></dd>
  1976. </dl>
  1977. </li>
  1978. </ul>
  1979. <a id="makeNestedClass(java.lang.String,boolean)">
  1980. <!-- -->
  1981. </a>
  1982. <ul class="blockList">
  1983. <li class="blockList">
  1984. <h4>makeNestedClass</h4>
  1985. <pre class="methodSignature">public&nbsp;<a href="CtClass.html" title="class in javassist">CtClass</a>&nbsp;makeNestedClass&#8203;(java.lang.String&nbsp;name,
  1986. boolean&nbsp;isStatic)</pre>
  1987. <div class="block">Makes a new public nested class. If this method is called,
  1988. the <code>CtClass</code>, which encloses the nested class, is modified
  1989. since a class file includes a list of nested classes.
  1990. <p>The current implementation only supports a static nested class.
  1991. <code>isStatic</code> must be true.</div>
  1992. <dl>
  1993. <dt><span class="paramLabel">Parameters:</span></dt>
  1994. <dd><code>name</code> - the simple name of the nested class.</dd>
  1995. <dd><code>isStatic</code> - true if the nested class is static.</dd>
  1996. </dl>
  1997. </li>
  1998. </ul>
  1999. <a id="getFields()">
  2000. <!-- -->
  2001. </a>
  2002. <ul class="blockList">
  2003. <li class="blockList">
  2004. <h4>getFields</h4>
  2005. <pre class="methodSignature">public&nbsp;<a href="CtField.html" title="class in javassist">CtField</a>[]&nbsp;getFields()</pre>
  2006. <div class="block">Returns an array containing <code>CtField</code> objects
  2007. representing all the non-private fields of the class.
  2008. That array includes non-private fields inherited from the
  2009. superclasses.</div>
  2010. </li>
  2011. </ul>
  2012. <a id="getField(java.lang.String)">
  2013. <!-- -->
  2014. </a>
  2015. <ul class="blockList">
  2016. <li class="blockList">
  2017. <h4>getField</h4>
  2018. <pre class="methodSignature">public&nbsp;<a href="CtField.html" title="class in javassist">CtField</a>&nbsp;getField&#8203;(java.lang.String&nbsp;name)
  2019. throws <a href="NotFoundException.html" title="class in javassist">NotFoundException</a></pre>
  2020. <div class="block">Returns the field with the specified name. The returned field
  2021. may be a private field declared in a super class or interface.</div>
  2022. <dl>
  2023. <dt><span class="throwsLabel">Throws:</span></dt>
  2024. <dd><code><a href="NotFoundException.html" title="class in javassist">NotFoundException</a></code></dd>
  2025. </dl>
  2026. </li>
  2027. </ul>
  2028. <a id="getField(java.lang.String,java.lang.String)">
  2029. <!-- -->
  2030. </a>
  2031. <ul class="blockList">
  2032. <li class="blockList">
  2033. <h4>getField</h4>
  2034. <pre class="methodSignature">public&nbsp;<a href="CtField.html" title="class in javassist">CtField</a>&nbsp;getField&#8203;(java.lang.String&nbsp;name,
  2035. java.lang.String&nbsp;desc)
  2036. throws <a href="NotFoundException.html" title="class in javassist">NotFoundException</a></pre>
  2037. <div class="block">Returns the field with the specified name and type. The returned field
  2038. may be a private field declared in a super class or interface.
  2039. Unlike Java, the JVM allows a class to have
  2040. multiple fields with the same name but different types.</div>
  2041. <dl>
  2042. <dt><span class="paramLabel">Parameters:</span></dt>
  2043. <dd><code>name</code> - the field name.</dd>
  2044. <dd><code>desc</code> - the type descriptor of the field. It is available by
  2045. <a href="CtField.html#getSignature()"><code>CtField.getSignature()</code></a>.</dd>
  2046. <dt><span class="throwsLabel">Throws:</span></dt>
  2047. <dd><code><a href="NotFoundException.html" title="class in javassist">NotFoundException</a></code></dd>
  2048. <dt><span class="seeLabel">See Also:</span></dt>
  2049. <dd><a href="CtField.html#getSignature()"><code>CtField.getSignature()</code></a></dd>
  2050. </dl>
  2051. </li>
  2052. </ul>
  2053. <a id="getDeclaredFields()">
  2054. <!-- -->
  2055. </a>
  2056. <ul class="blockList">
  2057. <li class="blockList">
  2058. <h4>getDeclaredFields</h4>
  2059. <pre class="methodSignature">public&nbsp;<a href="CtField.html" title="class in javassist">CtField</a>[]&nbsp;getDeclaredFields()</pre>
  2060. <div class="block">Gets all the fields declared in the class. The inherited fields
  2061. are not included.
  2062. <p>Note: the result does not include inherited fields.</div>
  2063. </li>
  2064. </ul>
  2065. <a id="getDeclaredField(java.lang.String)">
  2066. <!-- -->
  2067. </a>
  2068. <ul class="blockList">
  2069. <li class="blockList">
  2070. <h4>getDeclaredField</h4>
  2071. <pre class="methodSignature">public&nbsp;<a href="CtField.html" title="class in javassist">CtField</a>&nbsp;getDeclaredField&#8203;(java.lang.String&nbsp;name)
  2072. throws <a href="NotFoundException.html" title="class in javassist">NotFoundException</a></pre>
  2073. <div class="block">Retrieves the field with the specified name among the fields
  2074. declared in the class.
  2075. <p>Note: this method does not search the super classes.</div>
  2076. <dl>
  2077. <dt><span class="throwsLabel">Throws:</span></dt>
  2078. <dd><code><a href="NotFoundException.html" title="class in javassist">NotFoundException</a></code></dd>
  2079. </dl>
  2080. </li>
  2081. </ul>
  2082. <a id="getDeclaredField(java.lang.String,java.lang.String)">
  2083. <!-- -->
  2084. </a>
  2085. <ul class="blockList">
  2086. <li class="blockList">
  2087. <h4>getDeclaredField</h4>
  2088. <pre class="methodSignature">public&nbsp;<a href="CtField.html" title="class in javassist">CtField</a>&nbsp;getDeclaredField&#8203;(java.lang.String&nbsp;name,
  2089. java.lang.String&nbsp;desc)
  2090. throws <a href="NotFoundException.html" title="class in javassist">NotFoundException</a></pre>
  2091. <div class="block">Retrieves the field with the specified name and type among the fields
  2092. declared in the class. Unlike Java, the JVM allows a class to have
  2093. multiple fields with the same name but different types.
  2094. <p>Note: this method does not search the super classes.</div>
  2095. <dl>
  2096. <dt><span class="paramLabel">Parameters:</span></dt>
  2097. <dd><code>name</code> - the field name.</dd>
  2098. <dd><code>desc</code> - the type descriptor of the field. It is available by
  2099. <a href="CtField.html#getSignature()"><code>CtField.getSignature()</code></a>.</dd>
  2100. <dt><span class="throwsLabel">Throws:</span></dt>
  2101. <dd><code><a href="NotFoundException.html" title="class in javassist">NotFoundException</a></code></dd>
  2102. <dt><span class="seeLabel">See Also:</span></dt>
  2103. <dd><a href="CtField.html#getSignature()"><code>CtField.getSignature()</code></a></dd>
  2104. </dl>
  2105. </li>
  2106. </ul>
  2107. <a id="getDeclaredBehaviors()">
  2108. <!-- -->
  2109. </a>
  2110. <ul class="blockList">
  2111. <li class="blockList">
  2112. <h4>getDeclaredBehaviors</h4>
  2113. <pre class="methodSignature">public&nbsp;<a href="CtBehavior.html" title="class in javassist">CtBehavior</a>[]&nbsp;getDeclaredBehaviors()</pre>
  2114. <div class="block">Gets all the constructors and methods declared in the class.</div>
  2115. </li>
  2116. </ul>
  2117. <a id="getConstructors()">
  2118. <!-- -->
  2119. </a>
  2120. <ul class="blockList">
  2121. <li class="blockList">
  2122. <h4>getConstructors</h4>
  2123. <pre class="methodSignature">public&nbsp;<a href="CtConstructor.html" title="class in javassist">CtConstructor</a>[]&nbsp;getConstructors()</pre>
  2124. <div class="block">Returns an array containing <code>CtConstructor</code> objects
  2125. representing all the non-private constructors of the class.</div>
  2126. </li>
  2127. </ul>
  2128. <a id="getConstructor(java.lang.String)">
  2129. <!-- -->
  2130. </a>
  2131. <ul class="blockList">
  2132. <li class="blockList">
  2133. <h4>getConstructor</h4>
  2134. <pre class="methodSignature">public&nbsp;<a href="CtConstructor.html" title="class in javassist">CtConstructor</a>&nbsp;getConstructor&#8203;(java.lang.String&nbsp;desc)
  2135. throws <a href="NotFoundException.html" title="class in javassist">NotFoundException</a></pre>
  2136. <div class="block">Returns the constructor with the given signature,
  2137. which is represented by a character string
  2138. called method descriptor.
  2139. For details of the method descriptor, see the JVM specification
  2140. or <code>javassist.bytecode.Descriptor</code>.</div>
  2141. <dl>
  2142. <dt><span class="paramLabel">Parameters:</span></dt>
  2143. <dd><code>desc</code> - method descriptor</dd>
  2144. <dt><span class="throwsLabel">Throws:</span></dt>
  2145. <dd><code><a href="NotFoundException.html" title="class in javassist">NotFoundException</a></code></dd>
  2146. <dt><span class="seeLabel">See Also:</span></dt>
  2147. <dd><a href="bytecode/Descriptor.html" title="class in javassist.bytecode"><code>Descriptor</code></a></dd>
  2148. </dl>
  2149. </li>
  2150. </ul>
  2151. <a id="getDeclaredConstructors()">
  2152. <!-- -->
  2153. </a>
  2154. <ul class="blockList">
  2155. <li class="blockList">
  2156. <h4>getDeclaredConstructors</h4>
  2157. <pre class="methodSignature">public&nbsp;<a href="CtConstructor.html" title="class in javassist">CtConstructor</a>[]&nbsp;getDeclaredConstructors()</pre>
  2158. <div class="block">Gets all the constructors declared in the class.</div>
  2159. <dl>
  2160. <dt><span class="seeLabel">See Also:</span></dt>
  2161. <dd><a href="CtConstructor.html" title="class in javassist"><code>CtConstructor</code></a></dd>
  2162. </dl>
  2163. </li>
  2164. </ul>
  2165. <a id="getDeclaredConstructor(javassist.CtClass[])">
  2166. <!-- -->
  2167. </a>
  2168. <ul class="blockList">
  2169. <li class="blockList">
  2170. <h4>getDeclaredConstructor</h4>
  2171. <pre class="methodSignature">public&nbsp;<a href="CtConstructor.html" title="class in javassist">CtConstructor</a>&nbsp;getDeclaredConstructor&#8203;(<a href="CtClass.html" title="class in javassist">CtClass</a>[]&nbsp;params)
  2172. throws <a href="NotFoundException.html" title="class in javassist">NotFoundException</a></pre>
  2173. <div class="block">Returns a constructor receiving the specified parameters.</div>
  2174. <dl>
  2175. <dt><span class="paramLabel">Parameters:</span></dt>
  2176. <dd><code>params</code> - parameter types.</dd>
  2177. <dt><span class="throwsLabel">Throws:</span></dt>
  2178. <dd><code><a href="NotFoundException.html" title="class in javassist">NotFoundException</a></code></dd>
  2179. </dl>
  2180. </li>
  2181. </ul>
  2182. <a id="getClassInitializer()">
  2183. <!-- -->
  2184. </a>
  2185. <ul class="blockList">
  2186. <li class="blockList">
  2187. <h4>getClassInitializer</h4>
  2188. <pre class="methodSignature">public&nbsp;<a href="CtConstructor.html" title="class in javassist">CtConstructor</a>&nbsp;getClassInitializer()</pre>
  2189. <div class="block">Gets the class initializer (static constructor)
  2190. declared in the class.
  2191. This method returns <code>null</code> if
  2192. no class initializer is not declared.</div>
  2193. <dl>
  2194. <dt><span class="seeLabel">See Also:</span></dt>
  2195. <dd><a href="#makeClassInitializer()"><code>makeClassInitializer()</code></a>,
  2196. <a href="CtConstructor.html" title="class in javassist"><code>CtConstructor</code></a></dd>
  2197. </dl>
  2198. </li>
  2199. </ul>
  2200. <a id="getMethods()">
  2201. <!-- -->
  2202. </a>
  2203. <ul class="blockList">
  2204. <li class="blockList">
  2205. <h4>getMethods</h4>
  2206. <pre class="methodSignature">public&nbsp;<a href="CtMethod.html" title="class in javassist">CtMethod</a>[]&nbsp;getMethods()</pre>
  2207. <div class="block">Returns an array containing <code>CtMethod</code> objects
  2208. representing all the non-private methods of the class.
  2209. That array includes non-private methods inherited from the
  2210. superclasses.</div>
  2211. </li>
  2212. </ul>
  2213. <a id="getMethod(java.lang.String,java.lang.String)">
  2214. <!-- -->
  2215. </a>
  2216. <ul class="blockList">
  2217. <li class="blockList">
  2218. <h4>getMethod</h4>
  2219. <pre class="methodSignature">public&nbsp;<a href="CtMethod.html" title="class in javassist">CtMethod</a>&nbsp;getMethod&#8203;(java.lang.String&nbsp;name,
  2220. java.lang.String&nbsp;desc)
  2221. throws <a href="NotFoundException.html" title="class in javassist">NotFoundException</a></pre>
  2222. <div class="block">Returns the method with the given name and signature.
  2223. The returned method may be declared in a super class.
  2224. The method signature is represented by a character string
  2225. called method descriptor,
  2226. which is defined in the JVM specification.</div>
  2227. <dl>
  2228. <dt><span class="paramLabel">Parameters:</span></dt>
  2229. <dd><code>name</code> - method name</dd>
  2230. <dd><code>desc</code> - method descriptor</dd>
  2231. <dt><span class="throwsLabel">Throws:</span></dt>
  2232. <dd><code><a href="NotFoundException.html" title="class in javassist">NotFoundException</a></code></dd>
  2233. <dt><span class="seeLabel">See Also:</span></dt>
  2234. <dd><a href="CtBehavior.html#getSignature()"><code>CtBehavior.getSignature()</code></a>,
  2235. <a href="bytecode/Descriptor.html" title="class in javassist.bytecode"><code>Descriptor</code></a></dd>
  2236. </dl>
  2237. </li>
  2238. </ul>
  2239. <a id="getDeclaredMethods()">
  2240. <!-- -->
  2241. </a>
  2242. <ul class="blockList">
  2243. <li class="blockList">
  2244. <h4>getDeclaredMethods</h4>
  2245. <pre class="methodSignature">public&nbsp;<a href="CtMethod.html" title="class in javassist">CtMethod</a>[]&nbsp;getDeclaredMethods()</pre>
  2246. <div class="block">Gets all methods declared in the class. The inherited methods
  2247. are not included.</div>
  2248. <dl>
  2249. <dt><span class="seeLabel">See Also:</span></dt>
  2250. <dd><a href="CtMethod.html" title="class in javassist"><code>CtMethod</code></a></dd>
  2251. </dl>
  2252. </li>
  2253. </ul>
  2254. <a id="getDeclaredMethod(java.lang.String,javassist.CtClass[])">
  2255. <!-- -->
  2256. </a>
  2257. <ul class="blockList">
  2258. <li class="blockList">
  2259. <h4>getDeclaredMethod</h4>
  2260. <pre class="methodSignature">public&nbsp;<a href="CtMethod.html" title="class in javassist">CtMethod</a>&nbsp;getDeclaredMethod&#8203;(java.lang.String&nbsp;name,
  2261. <a href="CtClass.html" title="class in javassist">CtClass</a>[]&nbsp;params)
  2262. throws <a href="NotFoundException.html" title="class in javassist">NotFoundException</a></pre>
  2263. <div class="block">Retrieves the method with the specified name and parameter types
  2264. among the methods declared in the class.
  2265. <p>Note: this method does not search the superclasses.</div>
  2266. <dl>
  2267. <dt><span class="paramLabel">Parameters:</span></dt>
  2268. <dd><code>name</code> - method name</dd>
  2269. <dd><code>params</code> - parameter types</dd>
  2270. <dt><span class="throwsLabel">Throws:</span></dt>
  2271. <dd><code><a href="NotFoundException.html" title="class in javassist">NotFoundException</a></code></dd>
  2272. <dt><span class="seeLabel">See Also:</span></dt>
  2273. <dd><a href="CtMethod.html" title="class in javassist"><code>CtMethod</code></a></dd>
  2274. </dl>
  2275. </li>
  2276. </ul>
  2277. <a id="getDeclaredMethods(java.lang.String)">
  2278. <!-- -->
  2279. </a>
  2280. <ul class="blockList">
  2281. <li class="blockList">
  2282. <h4>getDeclaredMethods</h4>
  2283. <pre class="methodSignature">public&nbsp;<a href="CtMethod.html" title="class in javassist">CtMethod</a>[]&nbsp;getDeclaredMethods&#8203;(java.lang.String&nbsp;name)
  2284. throws <a href="NotFoundException.html" title="class in javassist">NotFoundException</a></pre>
  2285. <div class="block">Retrieves methods with the specified name among the methods
  2286. declared in the class. Multiple methods with different parameters
  2287. may be returned.
  2288. <p>Note: this method does not search the superclasses.</p></div>
  2289. <dl>
  2290. <dt><span class="paramLabel">Parameters:</span></dt>
  2291. <dd><code>name</code> - method name.</dd>
  2292. <dt><span class="throwsLabel">Throws:</span></dt>
  2293. <dd><code><a href="NotFoundException.html" title="class in javassist">NotFoundException</a></code></dd>
  2294. <dt><span class="simpleTagLabel">Since:</span></dt>
  2295. <dd>3.19</dd>
  2296. </dl>
  2297. </li>
  2298. </ul>
  2299. <a id="getDeclaredMethod(java.lang.String)">
  2300. <!-- -->
  2301. </a>
  2302. <ul class="blockList">
  2303. <li class="blockList">
  2304. <h4>getDeclaredMethod</h4>
  2305. <pre class="methodSignature">public&nbsp;<a href="CtMethod.html" title="class in javassist">CtMethod</a>&nbsp;getDeclaredMethod&#8203;(java.lang.String&nbsp;name)
  2306. throws <a href="NotFoundException.html" title="class in javassist">NotFoundException</a></pre>
  2307. <div class="block">Retrieves the method with the specified name among the methods
  2308. declared in the class. If there are multiple methods with
  2309. the specified name, then this method returns one of them.
  2310. <p>Note: this method does not search the superclasses.</div>
  2311. <dl>
  2312. <dt><span class="throwsLabel">Throws:</span></dt>
  2313. <dd><code><a href="NotFoundException.html" title="class in javassist">NotFoundException</a></code></dd>
  2314. <dt><span class="seeLabel">See Also:</span></dt>
  2315. <dd><a href="CtMethod.html" title="class in javassist"><code>CtMethod</code></a></dd>
  2316. </dl>
  2317. </li>
  2318. </ul>
  2319. <a id="makeClassInitializer()">
  2320. <!-- -->
  2321. </a>
  2322. <ul class="blockList">
  2323. <li class="blockList">
  2324. <h4>makeClassInitializer</h4>
  2325. <pre class="methodSignature">public&nbsp;<a href="CtConstructor.html" title="class in javassist">CtConstructor</a>&nbsp;makeClassInitializer()
  2326. throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
  2327. <div class="block">Makes an empty class initializer (static constructor).
  2328. If the class already includes a class initializer,
  2329. this method returns it.</div>
  2330. <dl>
  2331. <dt><span class="throwsLabel">Throws:</span></dt>
  2332. <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
  2333. <dt><span class="seeLabel">See Also:</span></dt>
  2334. <dd><a href="#getClassInitializer()"><code>getClassInitializer()</code></a></dd>
  2335. </dl>
  2336. </li>
  2337. </ul>
  2338. <a id="addConstructor(javassist.CtConstructor)">
  2339. <!-- -->
  2340. </a>
  2341. <ul class="blockList">
  2342. <li class="blockList">
  2343. <h4>addConstructor</h4>
  2344. <pre class="methodSignature">public&nbsp;void&nbsp;addConstructor&#8203;(<a href="CtConstructor.html" title="class in javassist">CtConstructor</a>&nbsp;c)
  2345. throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
  2346. <div class="block">Adds a constructor. To add a class initializer (static constructor),
  2347. call <code>makeClassInitializer()</code>.</div>
  2348. <dl>
  2349. <dt><span class="throwsLabel">Throws:</span></dt>
  2350. <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
  2351. <dt><span class="seeLabel">See Also:</span></dt>
  2352. <dd><a href="#makeClassInitializer()"><code>makeClassInitializer()</code></a></dd>
  2353. </dl>
  2354. </li>
  2355. </ul>
  2356. <a id="removeConstructor(javassist.CtConstructor)">
  2357. <!-- -->
  2358. </a>
  2359. <ul class="blockList">
  2360. <li class="blockList">
  2361. <h4>removeConstructor</h4>
  2362. <pre class="methodSignature">public&nbsp;void&nbsp;removeConstructor&#8203;(<a href="CtConstructor.html" title="class in javassist">CtConstructor</a>&nbsp;c)
  2363. throws <a href="NotFoundException.html" title="class in javassist">NotFoundException</a></pre>
  2364. <div class="block">Removes a constructor declared in this class.</div>
  2365. <dl>
  2366. <dt><span class="paramLabel">Parameters:</span></dt>
  2367. <dd><code>c</code> - removed constructor.</dd>
  2368. <dt><span class="throwsLabel">Throws:</span></dt>
  2369. <dd><code><a href="NotFoundException.html" title="class in javassist">NotFoundException</a></code> - if the constructor is not found.</dd>
  2370. </dl>
  2371. </li>
  2372. </ul>
  2373. <a id="addMethod(javassist.CtMethod)">
  2374. <!-- -->
  2375. </a>
  2376. <ul class="blockList">
  2377. <li class="blockList">
  2378. <h4>addMethod</h4>
  2379. <pre class="methodSignature">public&nbsp;void&nbsp;addMethod&#8203;(<a href="CtMethod.html" title="class in javassist">CtMethod</a>&nbsp;m)
  2380. throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
  2381. <div class="block">Adds a method.</div>
  2382. <dl>
  2383. <dt><span class="throwsLabel">Throws:</span></dt>
  2384. <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
  2385. </dl>
  2386. </li>
  2387. </ul>
  2388. <a id="removeMethod(javassist.CtMethod)">
  2389. <!-- -->
  2390. </a>
  2391. <ul class="blockList">
  2392. <li class="blockList">
  2393. <h4>removeMethod</h4>
  2394. <pre class="methodSignature">public&nbsp;void&nbsp;removeMethod&#8203;(<a href="CtMethod.html" title="class in javassist">CtMethod</a>&nbsp;m)
  2395. throws <a href="NotFoundException.html" title="class in javassist">NotFoundException</a></pre>
  2396. <div class="block">Removes a method declared in this class.</div>
  2397. <dl>
  2398. <dt><span class="paramLabel">Parameters:</span></dt>
  2399. <dd><code>m</code> - removed method.</dd>
  2400. <dt><span class="throwsLabel">Throws:</span></dt>
  2401. <dd><code><a href="NotFoundException.html" title="class in javassist">NotFoundException</a></code> - if the method is not found.</dd>
  2402. </dl>
  2403. </li>
  2404. </ul>
  2405. <a id="addField(javassist.CtField)">
  2406. <!-- -->
  2407. </a>
  2408. <ul class="blockList">
  2409. <li class="blockList">
  2410. <h4>addField</h4>
  2411. <pre class="methodSignature">public&nbsp;void&nbsp;addField&#8203;(<a href="CtField.html" title="class in javassist">CtField</a>&nbsp;f)
  2412. throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
  2413. <div class="block">Adds a field.
  2414. <p>The <code>CtField</code> belonging to another
  2415. <code>CtClass</code> cannot be directly added to this class.
  2416. Only a field created for this class can be added.</div>
  2417. <dl>
  2418. <dt><span class="throwsLabel">Throws:</span></dt>
  2419. <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
  2420. <dt><span class="seeLabel">See Also:</span></dt>
  2421. <dd><a href="CtField.html#%3Cinit%3E(javassist.CtField,javassist.CtClass)"><code>CtField(CtField,CtClass)</code></a></dd>
  2422. </dl>
  2423. </li>
  2424. </ul>
  2425. <a id="addField(javassist.CtField,java.lang.String)">
  2426. <!-- -->
  2427. </a>
  2428. <ul class="blockList">
  2429. <li class="blockList">
  2430. <h4>addField</h4>
  2431. <pre class="methodSignature">public&nbsp;void&nbsp;addField&#8203;(<a href="CtField.html" title="class in javassist">CtField</a>&nbsp;f,
  2432. java.lang.String&nbsp;init)
  2433. throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
  2434. <div class="block">Adds a field with an initial value.
  2435. <p>The <code>CtField</code> belonging to another
  2436. <code>CtClass</code> cannot be directly added to this class.
  2437. Only a field created for this class can be added.
  2438. <p>The initial value is given as an expression written in Java.
  2439. Any regular Java expression can be used for specifying the initial
  2440. value. The followings are examples.
  2441. <pre>
  2442. cc.addField(f, "0") // the initial value is 0.
  2443. cc.addField(f, "i + 1") // i + 1.
  2444. cc.addField(f, "new Point()"); // a Point object.
  2445. </pre>
  2446. <p>Here, the type of variable <code>cc</code> is <code>CtClass</code>.
  2447. The type of <code>f</code> is <code>CtField</code>.
  2448. <p>Note: do not change the modifier of the field
  2449. (in particular, do not add or remove <code>static</code>
  2450. to/from the modifier)
  2451. after it is added to the class by <code>addField()</code>.</div>
  2452. <dl>
  2453. <dt><span class="paramLabel">Parameters:</span></dt>
  2454. <dd><code>init</code> - an expression for the initial value.</dd>
  2455. <dt><span class="throwsLabel">Throws:</span></dt>
  2456. <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
  2457. <dt><span class="seeLabel">See Also:</span></dt>
  2458. <dd><a href="CtField.Initializer.html#byExpr(java.lang.String)"><code>CtField.Initializer.byExpr(String)</code></a>,
  2459. <a href="CtField.html#%3Cinit%3E(javassist.CtField,javassist.CtClass)"><code>CtField(CtField,CtClass)</code></a></dd>
  2460. </dl>
  2461. </li>
  2462. </ul>
  2463. <a id="addField(javassist.CtField,javassist.CtField.Initializer)">
  2464. <!-- -->
  2465. </a>
  2466. <ul class="blockList">
  2467. <li class="blockList">
  2468. <h4>addField</h4>
  2469. <pre class="methodSignature">public&nbsp;void&nbsp;addField&#8203;(<a href="CtField.html" title="class in javassist">CtField</a>&nbsp;f,
  2470. <a href="CtField.Initializer.html" title="class in javassist">CtField.Initializer</a>&nbsp;init)
  2471. throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
  2472. <div class="block">Adds a field with an initial value.
  2473. <p>The <code>CtField</code> belonging to another
  2474. <code>CtClass</code> cannot be directly added to this class.
  2475. Only a field created for this class can be added.
  2476. <p>For example,
  2477. <pre>
  2478. CtClass cc = ...;
  2479. addField(new CtField(CtClass.intType, "i", cc),
  2480. CtField.Initializer.constant(1));
  2481. </pre>
  2482. <p>This code adds an <code>int</code> field named "i". The
  2483. initial value of this field is 1.</div>
  2484. <dl>
  2485. <dt><span class="paramLabel">Parameters:</span></dt>
  2486. <dd><code>init</code> - specifies the initial value of the field.</dd>
  2487. <dt><span class="throwsLabel">Throws:</span></dt>
  2488. <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
  2489. <dt><span class="seeLabel">See Also:</span></dt>
  2490. <dd><a href="CtField.html#%3Cinit%3E(javassist.CtField,javassist.CtClass)"><code>CtField(CtField,CtClass)</code></a></dd>
  2491. </dl>
  2492. </li>
  2493. </ul>
  2494. <a id="removeField(javassist.CtField)">
  2495. <!-- -->
  2496. </a>
  2497. <ul class="blockList">
  2498. <li class="blockList">
  2499. <h4>removeField</h4>
  2500. <pre class="methodSignature">public&nbsp;void&nbsp;removeField&#8203;(<a href="CtField.html" title="class in javassist">CtField</a>&nbsp;f)
  2501. throws <a href="NotFoundException.html" title="class in javassist">NotFoundException</a></pre>
  2502. <div class="block">Removes a field declared in this class.</div>
  2503. <dl>
  2504. <dt><span class="paramLabel">Parameters:</span></dt>
  2505. <dd><code>f</code> - removed field.</dd>
  2506. <dt><span class="throwsLabel">Throws:</span></dt>
  2507. <dd><code><a href="NotFoundException.html" title="class in javassist">NotFoundException</a></code> - if the field is not found.</dd>
  2508. </dl>
  2509. </li>
  2510. </ul>
  2511. <a id="getAttribute(java.lang.String)">
  2512. <!-- -->
  2513. </a>
  2514. <ul class="blockList">
  2515. <li class="blockList">
  2516. <h4>getAttribute</h4>
  2517. <pre class="methodSignature">public&nbsp;byte[]&nbsp;getAttribute&#8203;(java.lang.String&nbsp;name)</pre>
  2518. <div class="block">Obtains an attribute with the given name.
  2519. If that attribute is not found in the class file, this
  2520. method returns null.
  2521. <p>This is a convenient method mainly for obtaining
  2522. a user-defined attribute. For dealing with attributes, see the
  2523. <code>javassist.bytecode</code> package. For example, the following
  2524. expression returns all the attributes of a class file.
  2525. <pre>
  2526. getClassFile().getAttributes()
  2527. </pre></div>
  2528. <dl>
  2529. <dt><span class="paramLabel">Parameters:</span></dt>
  2530. <dd><code>name</code> - attribute name</dd>
  2531. <dt><span class="seeLabel">See Also:</span></dt>
  2532. <dd><a href="bytecode/AttributeInfo.html" title="class in javassist.bytecode"><code>AttributeInfo</code></a></dd>
  2533. </dl>
  2534. </li>
  2535. </ul>
  2536. <a id="setAttribute(java.lang.String,byte[])">
  2537. <!-- -->
  2538. </a>
  2539. <ul class="blockList">
  2540. <li class="blockList">
  2541. <h4>setAttribute</h4>
  2542. <pre class="methodSignature">public&nbsp;void&nbsp;setAttribute&#8203;(java.lang.String&nbsp;name,
  2543. byte[]&nbsp;data)</pre>
  2544. <div class="block">Adds a named attribute.
  2545. An arbitrary data (smaller than 64Kb) can be saved in the class
  2546. file. Some attribute name are reserved by the JVM.
  2547. The attributes with the non-reserved names are ignored when a
  2548. class file is loaded into the JVM.
  2549. If there is already an attribute with
  2550. the same name, this method substitutes the new one for it.
  2551. <p>This is a convenient method mainly for adding
  2552. a user-defined attribute. For dealing with attributes, see the
  2553. <code>javassist.bytecode</code> package. For example, the following
  2554. expression adds an attribute <code>info</code> to a class file.
  2555. <pre>
  2556. getClassFile().addAttribute(info)
  2557. </pre></div>
  2558. <dl>
  2559. <dt><span class="paramLabel">Parameters:</span></dt>
  2560. <dd><code>name</code> - attribute name</dd>
  2561. <dd><code>data</code> - attribute value</dd>
  2562. <dt><span class="seeLabel">See Also:</span></dt>
  2563. <dd><a href="bytecode/AttributeInfo.html" title="class in javassist.bytecode"><code>AttributeInfo</code></a></dd>
  2564. </dl>
  2565. </li>
  2566. </ul>
  2567. <a id="instrument(javassist.CodeConverter)">
  2568. <!-- -->
  2569. </a>
  2570. <ul class="blockList">
  2571. <li class="blockList">
  2572. <h4>instrument</h4>
  2573. <pre class="methodSignature">public&nbsp;void&nbsp;instrument&#8203;(<a href="CodeConverter.html" title="class in javassist">CodeConverter</a>&nbsp;converter)
  2574. throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
  2575. <div class="block">Applies the given converter to all methods and constructors
  2576. declared in the class. This method calls <code>instrument()</code>
  2577. on every <code>CtMethod</code> and <code>CtConstructor</code> object
  2578. in the class.</div>
  2579. <dl>
  2580. <dt><span class="paramLabel">Parameters:</span></dt>
  2581. <dd><code>converter</code> - specifies how to modify.</dd>
  2582. <dt><span class="throwsLabel">Throws:</span></dt>
  2583. <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
  2584. </dl>
  2585. </li>
  2586. </ul>
  2587. <a id="instrument(javassist.expr.ExprEditor)">
  2588. <!-- -->
  2589. </a>
  2590. <ul class="blockList">
  2591. <li class="blockList">
  2592. <h4>instrument</h4>
  2593. <pre class="methodSignature">public&nbsp;void&nbsp;instrument&#8203;(<a href="expr/ExprEditor.html" title="class in javassist.expr">ExprEditor</a>&nbsp;editor)
  2594. throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
  2595. <div class="block">Modifies the bodies of all methods and constructors
  2596. declared in the class. This method calls <code>instrument()</code>
  2597. on every <code>CtMethod</code> and <code>CtConstructor</code> object
  2598. in the class.</div>
  2599. <dl>
  2600. <dt><span class="paramLabel">Parameters:</span></dt>
  2601. <dd><code>editor</code> - specifies how to modify.</dd>
  2602. <dt><span class="throwsLabel">Throws:</span></dt>
  2603. <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
  2604. </dl>
  2605. </li>
  2606. </ul>
  2607. <a id="toClass()">
  2608. <!-- -->
  2609. </a>
  2610. <ul class="blockList">
  2611. <li class="blockList">
  2612. <h4>toClass</h4>
  2613. <pre class="methodSignature">public&nbsp;java.lang.Class&lt;?&gt;&nbsp;toClass()
  2614. throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
  2615. <div class="block">Converts this class to a <code>java.lang.Class</code> object.
  2616. Once this method is called, further modifications are not
  2617. allowed any more.
  2618. To load the class, this method uses the context class loader
  2619. of the current thread. If the program is running on some application
  2620. server, the context class loader might be inappropriate to load the
  2621. class.
  2622. <p><b>Warning:</b> In Java 11 or later, the call to this method will
  2623. print a warning message:</p>
  2624. <blockquote><pre>
  2625. WARNING: An illegal reflective access operation has occurred
  2626. WARNING: Illegal reflective access by javassist.util.proxy.SecurityActions$3 ...
  2627. WARNING: Please consider reporting this to the maintainers of javassist.util.proxy.SecurityActions$3
  2628. WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
  2629. WARNING: All illegal access operations will be denied in a future release
  2630. </pre></blockquote>
  2631. <p>To avoid this message, use <a href="#toClass(java.lang.Class)"><code>toClass(Class)</code></a>
  2632. or <a href="#toClass(java.lang.invoke.MethodHandles.Lookup)"><code>toClass(java.lang.invoke.MethodHandles.Lookup)</code></a>.
  2633. <a href="#toClass()"><code>toClass()</code></a> will be unavailable in a future release.
  2634. </p>
  2635. <p><b>Warning:</b> A Class object returned by this method may not
  2636. work with a security manager or a signed jar file because a
  2637. protection domain is not specified.</p>
  2638. <p>Note: this method calls <code>toClass()</code>
  2639. in <code>ClassPool</code>.</p></div>
  2640. <dl>
  2641. <dt><span class="throwsLabel">Throws:</span></dt>
  2642. <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
  2643. <dt><span class="seeLabel">See Also:</span></dt>
  2644. <dd><a href="#toClass(java.lang.invoke.MethodHandles.Lookup)"><code>toClass(java.lang.invoke.MethodHandles.Lookup)</code></a>,
  2645. <a href="#toClass(java.lang.Class)"><code>toClass(Class)</code></a>,
  2646. <a href="ClassPool.html#toClass(javassist.CtClass)"><code>ClassPool.toClass(CtClass)</code></a></dd>
  2647. </dl>
  2648. </li>
  2649. </ul>
  2650. <a id="toClass(java.lang.Class)">
  2651. <!-- -->
  2652. </a>
  2653. <ul class="blockList">
  2654. <li class="blockList">
  2655. <h4>toClass</h4>
  2656. <pre class="methodSignature">public&nbsp;java.lang.Class&lt;?&gt;&nbsp;toClass&#8203;(java.lang.Class&lt;?&gt;&nbsp;neighbor)
  2657. throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
  2658. <div class="block">Converts this class to a <code>java.lang.Class</code> object.
  2659. Once this method is called, further modifications are not
  2660. allowed any more.
  2661. <p>This method is provided for convenience. You should use
  2662. <code>toClass(Lookup)</code> for better compatibility with the
  2663. module system.
  2664. <p>Note: this method calls <code>toClass()</code>
  2665. in <code>ClassPool</code>.
  2666. <p><b>Warning:</b> A Class object returned by this method may not
  2667. work with a security manager or a signed jar file because a
  2668. protection domain is not specified.</div>
  2669. <dl>
  2670. <dt><span class="paramLabel">Parameters:</span></dt>
  2671. <dd><code>neighbor</code> - A class belonging to the same package that this
  2672. class belongs to. It is used to load the class.</dd>
  2673. <dt><span class="throwsLabel">Throws:</span></dt>
  2674. <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
  2675. <dt><span class="simpleTagLabel">Since:</span></dt>
  2676. <dd>3.24</dd>
  2677. <dt><span class="seeLabel">See Also:</span></dt>
  2678. <dd><a href="ClassPool.html#toClass(javassist.CtClass,java.lang.Class)"><code>ClassPool.toClass(CtClass,Class)</code></a>,
  2679. <a href="#toClass(java.lang.invoke.MethodHandles.Lookup)"><code>toClass(java.lang.invoke.MethodHandles.Lookup)</code></a></dd>
  2680. </dl>
  2681. </li>
  2682. </ul>
  2683. <a id="toClass(java.lang.invoke.MethodHandles.Lookup)">
  2684. <!-- -->
  2685. </a>
  2686. <ul class="blockList">
  2687. <li class="blockList">
  2688. <h4>toClass</h4>
  2689. <pre class="methodSignature">public&nbsp;java.lang.Class&lt;?&gt;&nbsp;toClass&#8203;(java.lang.invoke.MethodHandles.Lookup&nbsp;lookup)
  2690. throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
  2691. <div class="block">Converts this class to a <code>java.lang.Class</code> object.
  2692. Once this method is called, further modifications are not
  2693. allowed any more.
  2694. <p>This method is provided for convenience. If you need more
  2695. complex functionality, you should write your own class loader.
  2696. <p>Note: this method calls <code>toClass()</code>
  2697. in <code>ClassPool</code>.
  2698. <p><b>Warning:</b> A Class object returned by this method may not
  2699. work with a security manager or a signed jar file because a
  2700. protection domain is not specified.</div>
  2701. <dl>
  2702. <dt><span class="paramLabel">Parameters:</span></dt>
  2703. <dd><code>lookup</code> - used when loading the class. It has to have
  2704. an access right to define a new class.</dd>
  2705. <dt><span class="throwsLabel">Throws:</span></dt>
  2706. <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
  2707. <dt><span class="simpleTagLabel">Since:</span></dt>
  2708. <dd>3.24</dd>
  2709. <dt><span class="seeLabel">See Also:</span></dt>
  2710. <dd><a href="ClassPool.html#toClass(javassist.CtClass,java.lang.invoke.MethodHandles.Lookup)"><code>ClassPool.toClass(CtClass,java.lang.invoke.MethodHandles.Lookup)</code></a></dd>
  2711. </dl>
  2712. </li>
  2713. </ul>
  2714. <a id="toClass(java.lang.ClassLoader,java.security.ProtectionDomain)">
  2715. <!-- -->
  2716. </a>
  2717. <ul class="blockList">
  2718. <li class="blockList">
  2719. <h4>toClass</h4>
  2720. <pre class="methodSignature">public&nbsp;java.lang.Class&lt;?&gt;&nbsp;toClass&#8203;(java.lang.ClassLoader&nbsp;loader,
  2721. java.security.ProtectionDomain&nbsp;domain)
  2722. throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
  2723. <div class="block">Converts this class to a <code>java.lang.Class</code> object.
  2724. Once this method is called, further modifications are not allowed
  2725. any more.
  2726. <p>The class file represented by this <code>CtClass</code> is
  2727. loaded by the given class loader to construct a
  2728. <code>java.lang.Class</code> object. Since a private method
  2729. on the class loader is invoked through the reflection API,
  2730. the caller must have permissions to do that.
  2731. <p>An easy way to obtain <code>ProtectionDomain</code> object is
  2732. to call <code>getProtectionDomain()</code>
  2733. in <code>java.lang.Class</code>. It returns the domain that
  2734. the class belongs to.
  2735. <p>This method is provided for convenience. If you need more
  2736. complex functionality, you should write your own class loader.
  2737. <p>Note: this method calls <code>toClass()</code>
  2738. in <code>ClassPool</code>.</div>
  2739. <dl>
  2740. <dt><span class="paramLabel">Parameters:</span></dt>
  2741. <dd><code>loader</code> - the class loader used to load this class.
  2742. If it is null, the class loader returned by
  2743. <a href="ClassPool.html#getClassLoader()"><code>ClassPool.getClassLoader()</code></a> is used.</dd>
  2744. <dd><code>domain</code> - the protection domain that the class belongs to.
  2745. If it is null, the default domain created
  2746. by <code>java.lang.ClassLoader</code> is used.</dd>
  2747. <dt><span class="throwsLabel">Throws:</span></dt>
  2748. <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
  2749. <dt><span class="simpleTagLabel">Since:</span></dt>
  2750. <dd>3.3</dd>
  2751. <dt><span class="seeLabel">See Also:</span></dt>
  2752. <dd><a href="ClassPool.html#toClass(javassist.CtClass,java.lang.ClassLoader)"><code>ClassPool.toClass(CtClass,java.lang.ClassLoader)</code></a></dd>
  2753. </dl>
  2754. </li>
  2755. </ul>
  2756. <a id="toClass(java.lang.ClassLoader)">
  2757. <!-- -->
  2758. </a>
  2759. <ul class="blockList">
  2760. <li class="blockList">
  2761. <h4>toClass</h4>
  2762. <pre class="methodSignature">@Deprecated
  2763. public final&nbsp;java.lang.Class&lt;?&gt;&nbsp;toClass&#8203;(java.lang.ClassLoader&nbsp;loader)
  2764. throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
  2765. <div class="deprecationBlock"><span class="deprecatedLabel">Deprecated.</span>
  2766. <div class="deprecationComment">Replaced by <a href="#toClass(java.lang.ClassLoader,java.security.ProtectionDomain)"><code>toClass(ClassLoader,ProtectionDomain)</code></a></div>
  2767. </div>
  2768. <div class="block">Converts this class to a <code>java.lang.Class</code> object.
  2769. <p><b>Warning:</b> A Class object returned by this method may not
  2770. work with a security manager or a signed jar file because a
  2771. protection domain is not specified.</div>
  2772. <dl>
  2773. <dt><span class="throwsLabel">Throws:</span></dt>
  2774. <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
  2775. </dl>
  2776. </li>
  2777. </ul>
  2778. <a id="detach()">
  2779. <!-- -->
  2780. </a>
  2781. <ul class="blockList">
  2782. <li class="blockList">
  2783. <h4>detach</h4>
  2784. <pre class="methodSignature">public&nbsp;void&nbsp;detach()</pre>
  2785. <div class="block">Removes this <code>CtClass</code> object from the
  2786. <code>ClassPool</code>.
  2787. After this method is called, any method cannot be called on the
  2788. removed <code>CtClass</code> object.
  2789. <p>If <code>get()</code> in <code>ClassPool</code> is called
  2790. with the name of the removed method,
  2791. the <code>ClassPool</code> will read the class file again
  2792. and constructs another <code>CtClass</code> object representing
  2793. the same class.</div>
  2794. </li>
  2795. </ul>
  2796. <a id="stopPruning(boolean)">
  2797. <!-- -->
  2798. </a>
  2799. <ul class="blockList">
  2800. <li class="blockList">
  2801. <h4>stopPruning</h4>
  2802. <pre class="methodSignature">public&nbsp;boolean&nbsp;stopPruning&#8203;(boolean&nbsp;stop)</pre>
  2803. <div class="block">Disallows (or allows) automatically pruning this <code>CtClass</code>
  2804. object.
  2805. <p>
  2806. Javassist can automatically prune a <code>CtClass</code> object
  2807. when <code>toBytecode()</code> (or <code>toClass()</code>,
  2808. <code>writeFile()</code>) is called.
  2809. Since a <code>ClassPool</code> holds all instances of <code>CtClass</code>
  2810. even after <code>toBytecode()</code> (or <code>toClass()</code>,
  2811. <code>writeFile()</code>) is called, pruning may significantly
  2812. save memory consumption.
  2813. <p>If <code>ClassPool.doPruning</code> is true, the automatic pruning
  2814. is on by default. Otherwise, it is off. The default value of
  2815. <code>ClassPool.doPruning</code> is false.</div>
  2816. <dl>
  2817. <dt><span class="paramLabel">Parameters:</span></dt>
  2818. <dd><code>stop</code> - disallow pruning if true. Otherwise, allow.</dd>
  2819. <dt><span class="returnLabel">Returns:</span></dt>
  2820. <dd>the previous status of pruning. true if pruning is already stopped.</dd>
  2821. <dt><span class="seeLabel">See Also:</span></dt>
  2822. <dd><a href="#detach()"><code>detach()</code></a>,
  2823. <a href="#prune()"><code>prune()</code></a>,
  2824. <a href="ClassPool.html#doPruning"><code>ClassPool.doPruning</code></a></dd>
  2825. </dl>
  2826. </li>
  2827. </ul>
  2828. <a id="prune()">
  2829. <!-- -->
  2830. </a>
  2831. <ul class="blockList">
  2832. <li class="blockList">
  2833. <h4>prune</h4>
  2834. <pre class="methodSignature">public&nbsp;void&nbsp;prune()</pre>
  2835. <div class="block">Discards unnecessary attributes, in particular,
  2836. <code>CodeAttribute</code>s (method bodies) of the class,
  2837. to minimize the memory footprint.
  2838. After calling this method, the class is read only.
  2839. It cannot be modified any more.
  2840. Furthermore, <code>toBytecode()</code>,
  2841. <code>writeFile()</code>, <code>toClass()</code>,
  2842. or <code>instrument()</code> cannot be called.
  2843. However, the method names and signatures in the class etc.
  2844. are still accessible.
  2845. <p><code>toBytecode()</code>, <code>writeFile()</code>, and
  2846. <code>toClass()</code> internally call this method if
  2847. automatic pruning is on.
  2848. <p>According to some experiments, pruning does not really reduce
  2849. memory consumption. Only about 20%. Since pruning takes time,
  2850. it might not pay off. So the automatic pruning is off by default.</div>
  2851. <dl>
  2852. <dt><span class="seeLabel">See Also:</span></dt>
  2853. <dd><a href="#stopPruning(boolean)"><code>stopPruning(boolean)</code></a>,
  2854. <a href="#detach()"><code>detach()</code></a>,
  2855. <a href="ClassPool.html#doPruning"><code>ClassPool.doPruning</code></a>,
  2856. <a href="#toBytecode()"><code>toBytecode()</code></a>,
  2857. <a href="#toClass(java.lang.Class)"><code>toClass(Class)</code></a>,
  2858. <a href="#writeFile()"><code>writeFile()</code></a>,
  2859. <a href="#instrument(javassist.CodeConverter)"><code>instrument(CodeConverter)</code></a>,
  2860. <a href="#instrument(javassist.expr.ExprEditor)"><code>instrument(ExprEditor)</code></a></dd>
  2861. </dl>
  2862. </li>
  2863. </ul>
  2864. <a id="rebuildClassFile()">
  2865. <!-- -->
  2866. </a>
  2867. <ul class="blockList">
  2868. <li class="blockList">
  2869. <h4>rebuildClassFile</h4>
  2870. <pre class="methodSignature">public&nbsp;void&nbsp;rebuildClassFile()</pre>
  2871. <div class="block">If this method is called, the class file will be
  2872. rebuilt when it is finally generated by
  2873. <code>toBytecode()</code> and <code>writeFile()</code>.
  2874. For a performance reason, the symbol table of the
  2875. class file may contain unused entries, for example,
  2876. after a method or a filed is deleted.
  2877. This method
  2878. removes those unused entries. This removal will
  2879. minimize the size of the class file.</div>
  2880. <dl>
  2881. <dt><span class="simpleTagLabel">Since:</span></dt>
  2882. <dd>3.8.1</dd>
  2883. </dl>
  2884. </li>
  2885. </ul>
  2886. <a id="toBytecode()">
  2887. <!-- -->
  2888. </a>
  2889. <ul class="blockList">
  2890. <li class="blockList">
  2891. <h4>toBytecode</h4>
  2892. <pre class="methodSignature">public&nbsp;byte[]&nbsp;toBytecode()
  2893. throws java.io.IOException,
  2894. <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
  2895. <div class="block">Converts this class to a class file.
  2896. Once this method is called, further modifications are not
  2897. possible any more.</div>
  2898. <dl>
  2899. <dt><span class="returnLabel">Returns:</span></dt>
  2900. <dd>the contents of the class file.</dd>
  2901. <dt><span class="throwsLabel">Throws:</span></dt>
  2902. <dd><code>java.io.IOException</code></dd>
  2903. <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
  2904. </dl>
  2905. </li>
  2906. </ul>
  2907. <a id="writeFile()">
  2908. <!-- -->
  2909. </a>
  2910. <ul class="blockList">
  2911. <li class="blockList">
  2912. <h4>writeFile</h4>
  2913. <pre class="methodSignature">public&nbsp;void&nbsp;writeFile()
  2914. throws <a href="NotFoundException.html" title="class in javassist">NotFoundException</a>,
  2915. java.io.IOException,
  2916. <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
  2917. <div class="block">Writes a class file represented by this <code>CtClass</code>
  2918. object in the current directory.
  2919. Once this method is called, further modifications are not
  2920. possible any more.</div>
  2921. <dl>
  2922. <dt><span class="throwsLabel">Throws:</span></dt>
  2923. <dd><code><a href="NotFoundException.html" title="class in javassist">NotFoundException</a></code></dd>
  2924. <dd><code>java.io.IOException</code></dd>
  2925. <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
  2926. <dt><span class="seeLabel">See Also:</span></dt>
  2927. <dd><a href="#debugWriteFile()"><code>debugWriteFile()</code></a></dd>
  2928. </dl>
  2929. </li>
  2930. </ul>
  2931. <a id="writeFile(java.lang.String)">
  2932. <!-- -->
  2933. </a>
  2934. <ul class="blockList">
  2935. <li class="blockList">
  2936. <h4>writeFile</h4>
  2937. <pre class="methodSignature">public&nbsp;void&nbsp;writeFile&#8203;(java.lang.String&nbsp;directoryName)
  2938. throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a>,
  2939. java.io.IOException</pre>
  2940. <div class="block">Writes a class file represented by this <code>CtClass</code>
  2941. object on a local disk.
  2942. Once this method is called, further modifications are not
  2943. possible any more.</div>
  2944. <dl>
  2945. <dt><span class="paramLabel">Parameters:</span></dt>
  2946. <dd><code>directoryName</code> - it must end without a directory separator.</dd>
  2947. <dt><span class="throwsLabel">Throws:</span></dt>
  2948. <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
  2949. <dd><code>java.io.IOException</code></dd>
  2950. <dt><span class="seeLabel">See Also:</span></dt>
  2951. <dd><a href="#debugWriteFile(java.lang.String)"><code>debugWriteFile(String)</code></a></dd>
  2952. </dl>
  2953. </li>
  2954. </ul>
  2955. <a id="debugWriteFile()">
  2956. <!-- -->
  2957. </a>
  2958. <ul class="blockList">
  2959. <li class="blockList">
  2960. <h4>debugWriteFile</h4>
  2961. <pre class="methodSignature">public&nbsp;void&nbsp;debugWriteFile()</pre>
  2962. <div class="block">Writes a class file as <code>writeFile()</code> does although this
  2963. method does not prune or freeze the class after writing the class
  2964. file. Note that, once <code>writeFile()</code> or <code>toBytecode()</code>
  2965. is called, it cannot be called again since the class is pruned and frozen.
  2966. This method would be useful for debugging.</div>
  2967. </li>
  2968. </ul>
  2969. <a id="debugWriteFile(java.lang.String)">
  2970. <!-- -->
  2971. </a>
  2972. <ul class="blockList">
  2973. <li class="blockList">
  2974. <h4>debugWriteFile</h4>
  2975. <pre class="methodSignature">public&nbsp;void&nbsp;debugWriteFile&#8203;(java.lang.String&nbsp;directoryName)</pre>
  2976. <div class="block">Writes a class file as <code>writeFile()</code> does although this
  2977. method does not prune or freeze the class after writing the class
  2978. file. Note that, once <code>writeFile()</code> or <code>toBytecode()</code>
  2979. is called, it cannot be called again since the class is pruned and frozen.
  2980. This method would be useful for debugging.</div>
  2981. <dl>
  2982. <dt><span class="paramLabel">Parameters:</span></dt>
  2983. <dd><code>directoryName</code> - it must end without a directory separator.</dd>
  2984. </dl>
  2985. </li>
  2986. </ul>
  2987. <a id="toBytecode(java.io.DataOutputStream)">
  2988. <!-- -->
  2989. </a>
  2990. <ul class="blockList">
  2991. <li class="blockList">
  2992. <h4>toBytecode</h4>
  2993. <pre class="methodSignature">public&nbsp;void&nbsp;toBytecode&#8203;(java.io.DataOutputStream&nbsp;out)
  2994. throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a>,
  2995. java.io.IOException</pre>
  2996. <div class="block">Converts this class to a class file.
  2997. Once this method is called, further modifications are not
  2998. possible any more.
  2999. <p>This method dose not close the output stream in the end.</div>
  3000. <dl>
  3001. <dt><span class="paramLabel">Parameters:</span></dt>
  3002. <dd><code>out</code> - the output stream that a class file is written to.</dd>
  3003. <dt><span class="throwsLabel">Throws:</span></dt>
  3004. <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
  3005. <dd><code>java.io.IOException</code></dd>
  3006. </dl>
  3007. </li>
  3008. </ul>
  3009. <a id="makeUniqueName(java.lang.String)">
  3010. <!-- -->
  3011. </a>
  3012. <ul class="blockListLast">
  3013. <li class="blockList">
  3014. <h4>makeUniqueName</h4>
  3015. <pre class="methodSignature">public&nbsp;java.lang.String&nbsp;makeUniqueName&#8203;(java.lang.String&nbsp;prefix)</pre>
  3016. <div class="block">Makes a unique member name. This method guarantees that
  3017. the returned name is not used as a prefix of any methods
  3018. or fields visible in this class.
  3019. If the returned name is XYZ, then any method or field names
  3020. in this class do not start with XYZ.</div>
  3021. <dl>
  3022. <dt><span class="paramLabel">Parameters:</span></dt>
  3023. <dd><code>prefix</code> - the prefix of the member name.</dd>
  3024. </dl>
  3025. </li>
  3026. </ul>
  3027. </li>
  3028. </ul>
  3029. </section>
  3030. </li>
  3031. </ul>
  3032. </div>
  3033. </div>
  3034. </main>
  3035. <!-- ========= END OF CLASS DATA ========= -->
  3036. <footer role="contentinfo">
  3037. <nav role="navigation">
  3038. <!-- ======= START OF BOTTOM NAVBAR ====== -->
  3039. <div class="bottomNav"><a id="navbar.bottom">
  3040. <!-- -->
  3041. </a>
  3042. <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
  3043. <a id="navbar.bottom.firstrow">
  3044. <!-- -->
  3045. </a>
  3046. <ul class="navList" title="Navigation">
  3047. <li><a href="../index.html">Overview</a></li>
  3048. <li><a href="package-summary.html">Package</a></li>
  3049. <li class="navBarCell1Rev">Class</li>
  3050. <li><a href="class-use/CtClass.html">Use</a></li>
  3051. <li><a href="package-tree.html">Tree</a></li>
  3052. <li><a href="../deprecated-list.html">Deprecated</a></li>
  3053. <li><a href="../index-all.html">Index</a></li>
  3054. </ul>
  3055. </div>
  3056. <div class="subNav">
  3057. <ul class="navList" id="allclasses_navbar_bottom">
  3058. <li><a href="../allclasses.html">All&nbsp;Classes</a></li>
  3059. </ul>
  3060. <div>
  3061. <script type="text/javascript"><!--
  3062. allClassesLink = document.getElementById("allclasses_navbar_bottom");
  3063. if(window==top) {
  3064. allClassesLink.style.display = "block";
  3065. }
  3066. else {
  3067. allClassesLink.style.display = "none";
  3068. }
  3069. //-->
  3070. </script>
  3071. <noscript>
  3072. <div>JavaScript is disabled on your browser.</div>
  3073. </noscript>
  3074. </div>
  3075. <div>
  3076. <ul class="subNavList">
  3077. <li>Summary:&nbsp;</li>
  3078. <li>Nested&nbsp;|&nbsp;</li>
  3079. <li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
  3080. <li>Constr&nbsp;|&nbsp;</li>
  3081. <li><a href="#method.summary">Method</a></li>
  3082. </ul>
  3083. <ul class="subNavList">
  3084. <li>Detail:&nbsp;</li>
  3085. <li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
  3086. <li>Constr&nbsp;|&nbsp;</li>
  3087. <li><a href="#method.detail">Method</a></li>
  3088. </ul>
  3089. </div>
  3090. <a id="skip.navbar.bottom">
  3091. <!-- -->
  3092. </a></div>
  3093. <!-- ======== END OF BOTTOM NAVBAR ======= -->
  3094. </nav>
  3095. <p class="legalCopy"><small><i>Javassist, a Java-bytecode translator toolkit.<br>
  3096. Copyright (C) 1999- Shigeru Chiba. All Rights Reserved.</i></small></p>
  3097. </footer>
  3098. </body>
  3099. </html>