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.

CtBehavior.html 60KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370
  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>CtBehavior (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="CtBehavior (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":6,"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":6,"i29":10,"i30":10,"i31":10,"i32":10,"i33":10,"i34":10,"i35":10};
  32. var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"],8:["t4","Concrete 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/CtBehavior.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>Field&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>Field&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 CtBehavior" class="title">Class CtBehavior</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><a href="CtMember.html" title="class in javassist">javassist.CtMember</a></li>
  128. <li>
  129. <ul class="inheritance">
  130. <li>javassist.CtBehavior</li>
  131. </ul>
  132. </li>
  133. </ul>
  134. </li>
  135. </ul>
  136. <div class="description">
  137. <ul class="blockList">
  138. <li class="blockList">
  139. <dl>
  140. <dt>Direct Known Subclasses:</dt>
  141. <dd><code><a href="CtConstructor.html" title="class in javassist">CtConstructor</a></code>, <code><a href="CtMethod.html" title="class in javassist">CtMethod</a></code></dd>
  142. </dl>
  143. <hr>
  144. <pre>public abstract class <span class="typeNameLabel">CtBehavior</span>
  145. extends <a href="CtMember.html" title="class in javassist">CtMember</a></pre>
  146. <div class="block"><code>CtBehavior</code> represents a method, a constructor,
  147. or a static constructor (class initializer).
  148. It is the abstract super class of
  149. <code>CtMethod</code> and <code>CtConstructor</code>.
  150. <p>To directly read or modify bytecode, obtain <code>MethodInfo</code>
  151. objects.</div>
  152. <dl>
  153. <dt><span class="seeLabel">See Also:</span></dt>
  154. <dd><a href="#getMethodInfo()"><code>getMethodInfo()</code></a></dd>
  155. </dl>
  156. </li>
  157. </ul>
  158. </div>
  159. <div class="summary">
  160. <ul class="blockList">
  161. <li class="blockList">
  162. <!-- ========== METHOD SUMMARY =========== -->
  163. <section role="region">
  164. <ul class="blockList">
  165. <li class="blockList"><a id="method.summary">
  166. <!-- -->
  167. </a>
  168. <h3>Method Summary</h3>
  169. <table class="memberSummary">
  170. <caption><span id="t0" class="activeTableTab"><span>All Methods</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="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract 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></caption>
  171. <tr>
  172. <th class="colFirst" scope="col">Modifier and Type</th>
  173. <th class="colSecond" scope="col">Method</th>
  174. <th class="colLast" scope="col">Description</th>
  175. </tr>
  176. <tr id="i0" class="altColor">
  177. <td class="colFirst"><code>void</code></td>
  178. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#addCatch(java.lang.String,javassist.CtClass)">addCatch</a></span>&#8203;(java.lang.String&nbsp;src,
  179. <a href="CtClass.html" title="class in javassist">CtClass</a>&nbsp;exceptionType)</code></th>
  180. <td class="colLast">
  181. <div class="block">Adds a catch clause that handles an exception thrown in the
  182. body.</div>
  183. </td>
  184. </tr>
  185. <tr id="i1" class="rowColor">
  186. <td class="colFirst"><code>void</code></td>
  187. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#addCatch(java.lang.String,javassist.CtClass,java.lang.String)">addCatch</a></span>&#8203;(java.lang.String&nbsp;src,
  188. <a href="CtClass.html" title="class in javassist">CtClass</a>&nbsp;exceptionType,
  189. java.lang.String&nbsp;exceptionName)</code></th>
  190. <td class="colLast">
  191. <div class="block">Adds a catch clause that handles an exception thrown in the
  192. body.</div>
  193. </td>
  194. </tr>
  195. <tr id="i2" class="altColor">
  196. <td class="colFirst"><code>void</code></td>
  197. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#addLocalVariable(java.lang.String,javassist.CtClass)">addLocalVariable</a></span>&#8203;(java.lang.String&nbsp;name,
  198. <a href="CtClass.html" title="class in javassist">CtClass</a>&nbsp;type)</code></th>
  199. <td class="colLast">
  200. <div class="block">Declares a new local variable.</div>
  201. </td>
  202. </tr>
  203. <tr id="i3" class="rowColor">
  204. <td class="colFirst"><code>void</code></td>
  205. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#addParameter(javassist.CtClass)">addParameter</a></span>&#8203;(<a href="CtClass.html" title="class in javassist">CtClass</a>&nbsp;type)</code></th>
  206. <td class="colLast">
  207. <div class="block">Appends a new parameter, which becomes the last parameter.</div>
  208. </td>
  209. </tr>
  210. <tr id="i4" class="altColor">
  211. <td class="colFirst"><code>java.lang.Object</code></td>
  212. <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>
  213. <td class="colLast">
  214. <div class="block">Returns the annotation if the class has the specified annotation class.</div>
  215. </td>
  216. </tr>
  217. <tr id="i5" class="rowColor">
  218. <td class="colFirst"><code>java.lang.Object[]</code></td>
  219. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getAnnotations()">getAnnotations</a></span>()</code></th>
  220. <td class="colLast">
  221. <div class="block">Returns the annotations associated with this method or constructor.</div>
  222. </td>
  223. </tr>
  224. <tr id="i6" class="altColor">
  225. <td class="colFirst"><code>byte[]</code></td>
  226. <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>
  227. <td class="colLast">
  228. <div class="block">Obtains an attribute with the given name.</div>
  229. </td>
  230. </tr>
  231. <tr id="i7" class="rowColor">
  232. <td class="colFirst"><code>java.lang.Object[]</code></td>
  233. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getAvailableAnnotations()">getAvailableAnnotations</a></span>()</code></th>
  234. <td class="colLast">
  235. <div class="block">Returns the annotations associated with this method or constructor.</div>
  236. </td>
  237. </tr>
  238. <tr id="i8" class="altColor">
  239. <td class="colFirst"><code>java.lang.Object[][]</code></td>
  240. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getAvailableParameterAnnotations()">getAvailableParameterAnnotations</a></span>()</code></th>
  241. <td class="colLast">
  242. <div class="block">Returns the parameter annotations associated with this method or constructor.</div>
  243. </td>
  244. </tr>
  245. <tr id="i9" class="rowColor">
  246. <td class="colFirst"><code><a href="CtClass.html" title="class in javassist">CtClass</a>[]</code></td>
  247. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getExceptionTypes()">getExceptionTypes</a></span>()</code></th>
  248. <td class="colLast">
  249. <div class="block">Obtains exceptions that this method/constructor may throw.</div>
  250. </td>
  251. </tr>
  252. <tr id="i10" class="altColor">
  253. <td class="colFirst"><code>java.lang.String</code></td>
  254. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getGenericSignature()">getGenericSignature</a></span>()</code></th>
  255. <td class="colLast">
  256. <div class="block">Returns the generic signature of the method.</div>
  257. </td>
  258. </tr>
  259. <tr id="i11" class="rowColor">
  260. <td class="colFirst"><code>abstract java.lang.String</code></td>
  261. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getLongName()">getLongName</a></span>()</code></th>
  262. <td class="colLast">
  263. <div class="block">Returns the method or constructor name followed by parameter types
  264. such as <code>javassist.CtBehavior.stBody(String)</code>.</div>
  265. </td>
  266. </tr>
  267. <tr id="i12" class="altColor">
  268. <td class="colFirst"><code><a href="bytecode/MethodInfo.html" title="class in javassist.bytecode">MethodInfo</a></code></td>
  269. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getMethodInfo()">getMethodInfo</a></span>()</code></th>
  270. <td class="colLast">
  271. <div class="block">Returns the <code>MethodInfo</code> representing this method/constructor in the
  272. class file.</div>
  273. </td>
  274. </tr>
  275. <tr id="i13" class="rowColor">
  276. <td class="colFirst"><code><a href="bytecode/MethodInfo.html" title="class in javassist.bytecode">MethodInfo</a></code></td>
  277. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getMethodInfo2()">getMethodInfo2</a></span>()</code></th>
  278. <td class="colLast">
  279. <div class="block">Returns the <code>MethodInfo</code> representing the method/constructor in the
  280. class file (read only).</div>
  281. </td>
  282. </tr>
  283. <tr id="i14" class="altColor">
  284. <td class="colFirst"><code>int</code></td>
  285. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getModifiers()">getModifiers</a></span>()</code></th>
  286. <td class="colLast">
  287. <div class="block">Obtains the modifiers of the method/constructor.</div>
  288. </td>
  289. </tr>
  290. <tr id="i15" class="rowColor">
  291. <td class="colFirst"><code>java.lang.Object[][]</code></td>
  292. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getParameterAnnotations()">getParameterAnnotations</a></span>()</code></th>
  293. <td class="colLast">
  294. <div class="block">Returns the parameter annotations associated with this method or constructor.</div>
  295. </td>
  296. </tr>
  297. <tr id="i16" class="altColor">
  298. <td class="colFirst"><code><a href="CtClass.html" title="class in javassist">CtClass</a>[]</code></td>
  299. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getParameterTypes()">getParameterTypes</a></span>()</code></th>
  300. <td class="colLast">
  301. <div class="block">Obtains parameter types of this method/constructor.</div>
  302. </td>
  303. </tr>
  304. <tr id="i17" class="rowColor">
  305. <td class="colFirst"><code>java.lang.String</code></td>
  306. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getSignature()">getSignature</a></span>()</code></th>
  307. <td class="colLast">
  308. <div class="block">Returns the method signature (the parameter types
  309. and the return type).</div>
  310. </td>
  311. </tr>
  312. <tr id="i18" class="altColor">
  313. <td class="colFirst"><code>boolean</code></td>
  314. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#hasAnnotation(java.lang.String)">hasAnnotation</a></span>&#8203;(java.lang.String&nbsp;typeName)</code></th>
  315. <td class="colLast">
  316. <div class="block">Returns true if the class has the specified annotation type.</div>
  317. </td>
  318. </tr>
  319. <tr id="i19" class="rowColor">
  320. <td class="colFirst"><code>void</code></td>
  321. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#insertAfter(java.lang.String)">insertAfter</a></span>&#8203;(java.lang.String&nbsp;src)</code></th>
  322. <td class="colLast">
  323. <div class="block">Inserts bytecode at the end of the body.</div>
  324. </td>
  325. </tr>
  326. <tr id="i20" class="altColor">
  327. <td class="colFirst"><code>void</code></td>
  328. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#insertAfter(java.lang.String,boolean)">insertAfter</a></span>&#8203;(java.lang.String&nbsp;src,
  329. boolean&nbsp;asFinally)</code></th>
  330. <td class="colLast">
  331. <div class="block">Inserts bytecode at the end of the body.</div>
  332. </td>
  333. </tr>
  334. <tr id="i21" class="rowColor">
  335. <td class="colFirst"><code>void</code></td>
  336. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#insertAfter(java.lang.String,boolean,boolean)">insertAfter</a></span>&#8203;(java.lang.String&nbsp;src,
  337. boolean&nbsp;asFinally,
  338. boolean&nbsp;redundant)</code></th>
  339. <td class="colLast">
  340. <div class="block">Inserts bytecode at the end of the body.</div>
  341. </td>
  342. </tr>
  343. <tr id="i22" class="altColor">
  344. <td class="colFirst"><code>int</code></td>
  345. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#insertAt(int,boolean,java.lang.String)">insertAt</a></span>&#8203;(int&nbsp;lineNum,
  346. boolean&nbsp;modify,
  347. java.lang.String&nbsp;src)</code></th>
  348. <td class="colLast">
  349. <div class="block">Inserts bytecode at the specified line in the body.</div>
  350. </td>
  351. </tr>
  352. <tr id="i23" class="rowColor">
  353. <td class="colFirst"><code>int</code></td>
  354. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#insertAt(int,java.lang.String)">insertAt</a></span>&#8203;(int&nbsp;lineNum,
  355. java.lang.String&nbsp;src)</code></th>
  356. <td class="colLast">
  357. <div class="block">Inserts bytecode at the specified line in the body.</div>
  358. </td>
  359. </tr>
  360. <tr id="i24" class="altColor">
  361. <td class="colFirst"><code>void</code></td>
  362. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#insertBefore(java.lang.String)">insertBefore</a></span>&#8203;(java.lang.String&nbsp;src)</code></th>
  363. <td class="colLast">
  364. <div class="block">Inserts bytecode at the beginning of the body.</div>
  365. </td>
  366. </tr>
  367. <tr id="i25" class="rowColor">
  368. <td class="colFirst"><code>void</code></td>
  369. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#insertParameter(javassist.CtClass)">insertParameter</a></span>&#8203;(<a href="CtClass.html" title="class in javassist">CtClass</a>&nbsp;type)</code></th>
  370. <td class="colLast">
  371. <div class="block">Inserts a new parameter, which becomes the first parameter.</div>
  372. </td>
  373. </tr>
  374. <tr id="i26" class="altColor">
  375. <td class="colFirst"><code>void</code></td>
  376. <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>
  377. <td class="colLast">
  378. <div class="block">Modifies the method/constructor body.</div>
  379. </td>
  380. </tr>
  381. <tr id="i27" class="rowColor">
  382. <td class="colFirst"><code>void</code></td>
  383. <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>
  384. <td class="colLast">
  385. <div class="block">Modifies the method/constructor body.</div>
  386. </td>
  387. </tr>
  388. <tr id="i28" class="altColor">
  389. <td class="colFirst"><code>abstract boolean</code></td>
  390. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isEmpty()">isEmpty</a></span>()</code></th>
  391. <td class="colLast">
  392. <div class="block">Returns true if the body is empty.</div>
  393. </td>
  394. </tr>
  395. <tr id="i29" class="rowColor">
  396. <td class="colFirst"><code>void</code></td>
  397. <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,
  398. byte[]&nbsp;data)</code></th>
  399. <td class="colLast">
  400. <div class="block">Adds an attribute.</div>
  401. </td>
  402. </tr>
  403. <tr id="i30" class="altColor">
  404. <td class="colFirst"><code>void</code></td>
  405. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setBody(java.lang.String)">setBody</a></span>&#8203;(java.lang.String&nbsp;src)</code></th>
  406. <td class="colLast">
  407. <div class="block">Sets a method/constructor body.</div>
  408. </td>
  409. </tr>
  410. <tr id="i31" class="rowColor">
  411. <td class="colFirst"><code>void</code></td>
  412. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setBody(java.lang.String,java.lang.String,java.lang.String)">setBody</a></span>&#8203;(java.lang.String&nbsp;src,
  413. java.lang.String&nbsp;delegateObj,
  414. java.lang.String&nbsp;delegateMethod)</code></th>
  415. <td class="colLast">
  416. <div class="block">Sets a method/constructor body.</div>
  417. </td>
  418. </tr>
  419. <tr id="i32" class="altColor">
  420. <td class="colFirst"><code>void</code></td>
  421. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setExceptionTypes(javassist.CtClass%5B%5D)">setExceptionTypes</a></span>&#8203;(<a href="CtClass.html" title="class in javassist">CtClass</a>[]&nbsp;types)</code></th>
  422. <td class="colLast">
  423. <div class="block">Sets exceptions that this method/constructor may throw.</div>
  424. </td>
  425. </tr>
  426. <tr id="i33" class="rowColor">
  427. <td class="colFirst"><code>void</code></td>
  428. <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>
  429. <td class="colLast">
  430. <div class="block">Set the generic signature of the method.</div>
  431. </td>
  432. </tr>
  433. <tr id="i34" class="altColor">
  434. <td class="colFirst"><code>void</code></td>
  435. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setModifiers(int)">setModifiers</a></span>&#8203;(int&nbsp;mod)</code></th>
  436. <td class="colLast">
  437. <div class="block">Sets the encoded modifiers of the method/constructor.</div>
  438. </td>
  439. </tr>
  440. <tr id="i35" class="rowColor">
  441. <td class="colFirst"><code>void</code></td>
  442. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#useCflow(java.lang.String)">useCflow</a></span>&#8203;(java.lang.String&nbsp;name)</code></th>
  443. <td class="colLast">
  444. <div class="block">Declares to use <code>$cflow</code> for this method/constructor.</div>
  445. </td>
  446. </tr>
  447. </table>
  448. <ul class="blockList">
  449. <li class="blockList"><a id="methods.inherited.from.class.javassist.CtMember">
  450. <!-- -->
  451. </a>
  452. <h3>Methods inherited from class&nbsp;javassist.<a href="CtMember.html" title="class in javassist">CtMember</a></h3>
  453. <code><a href="CtMember.html#getDeclaringClass()">getDeclaringClass</a>, <a href="CtMember.html#getName()">getName</a>, <a href="CtMember.html#hasAnnotation(java.lang.Class)">hasAnnotation</a>, <a href="CtMember.html#toString()">toString</a>, <a href="CtMember.html#visibleFrom(javassist.CtClass)">visibleFrom</a></code></li>
  454. </ul>
  455. <ul class="blockList">
  456. <li class="blockList"><a id="methods.inherited.from.class.java.lang.Object">
  457. <!-- -->
  458. </a>
  459. <h3>Methods inherited from class&nbsp;java.lang.Object</h3>
  460. <code>equals, getClass, hashCode, notify, notifyAll, wait, wait, wait</code></li>
  461. </ul>
  462. </li>
  463. </ul>
  464. </section>
  465. </li>
  466. </ul>
  467. </div>
  468. <div class="details">
  469. <ul class="blockList">
  470. <li class="blockList">
  471. <!-- ============ METHOD DETAIL ========== -->
  472. <section role="region">
  473. <ul class="blockList">
  474. <li class="blockList"><a id="method.detail">
  475. <!-- -->
  476. </a>
  477. <h3>Method Detail</h3>
  478. <a id="getLongName()">
  479. <!-- -->
  480. </a>
  481. <ul class="blockList">
  482. <li class="blockList">
  483. <h4>getLongName</h4>
  484. <pre class="methodSignature">public abstract&nbsp;java.lang.String&nbsp;getLongName()</pre>
  485. <div class="block">Returns the method or constructor name followed by parameter types
  486. such as <code>javassist.CtBehavior.stBody(String)</code>.</div>
  487. <dl>
  488. <dt><span class="simpleTagLabel">Since:</span></dt>
  489. <dd>3.5</dd>
  490. </dl>
  491. </li>
  492. </ul>
  493. <a id="getMethodInfo()">
  494. <!-- -->
  495. </a>
  496. <ul class="blockList">
  497. <li class="blockList">
  498. <h4>getMethodInfo</h4>
  499. <pre class="methodSignature">public&nbsp;<a href="bytecode/MethodInfo.html" title="class in javassist.bytecode">MethodInfo</a>&nbsp;getMethodInfo()</pre>
  500. <div class="block">Returns the <code>MethodInfo</code> representing this method/constructor in the
  501. class file.
  502. <p>If you modify the bytecode through the returned
  503. <code>MethodInfo</code> object, you might have to explicitly
  504. rebuild a stack map table. Javassist does not automatically
  505. rebuild it for avoiding unnecessary rebuilding.</div>
  506. <dl>
  507. <dt><span class="seeLabel">See Also:</span></dt>
  508. <dd><a href="bytecode/MethodInfo.html#rebuildStackMap(javassist.ClassPool)"><code>MethodInfo.rebuildStackMap(ClassPool)</code></a></dd>
  509. </dl>
  510. </li>
  511. </ul>
  512. <a id="getMethodInfo2()">
  513. <!-- -->
  514. </a>
  515. <ul class="blockList">
  516. <li class="blockList">
  517. <h4>getMethodInfo2</h4>
  518. <pre class="methodSignature">public&nbsp;<a href="bytecode/MethodInfo.html" title="class in javassist.bytecode">MethodInfo</a>&nbsp;getMethodInfo2()</pre>
  519. <div class="block">Returns the <code>MethodInfo</code> representing the method/constructor in the
  520. class file (read only).
  521. Normal applications do not need calling this method. Use
  522. <code>getMethodInfo()</code>.
  523. <p>The <code>MethodInfo</code> object obtained by this method
  524. is read only. Changes to this object might not be reflected
  525. on a class file generated by <code>toBytecode()</code>,
  526. <code>toClass()</code>, etc in <code>CtClass</code>.
  527. <p>This method is available even if the <code>CtClass</code>
  528. containing this method is frozen. However, if the class is
  529. frozen, the <code>MethodInfo</code> might be also pruned.</div>
  530. <dl>
  531. <dt><span class="seeLabel">See Also:</span></dt>
  532. <dd><a href="#getMethodInfo()"><code>getMethodInfo()</code></a>,
  533. <a href="CtClass.html#isFrozen()"><code>CtClass.isFrozen()</code></a>,
  534. <a href="CtClass.html#prune()"><code>CtClass.prune()</code></a></dd>
  535. </dl>
  536. </li>
  537. </ul>
  538. <a id="getModifiers()">
  539. <!-- -->
  540. </a>
  541. <ul class="blockList">
  542. <li class="blockList">
  543. <h4>getModifiers</h4>
  544. <pre class="methodSignature">public&nbsp;int&nbsp;getModifiers()</pre>
  545. <div class="block">Obtains the modifiers of the method/constructor.</div>
  546. <dl>
  547. <dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
  548. <dd><code><a href="CtMember.html#getModifiers()">getModifiers</a></code>&nbsp;in class&nbsp;<code><a href="CtMember.html" title="class in javassist">CtMember</a></code></dd>
  549. <dt><span class="returnLabel">Returns:</span></dt>
  550. <dd>modifiers encoded with
  551. <code>javassist.Modifier</code>.</dd>
  552. <dt><span class="seeLabel">See Also:</span></dt>
  553. <dd><a href="Modifier.html" title="class in javassist"><code>Modifier</code></a></dd>
  554. </dl>
  555. </li>
  556. </ul>
  557. <a id="setModifiers(int)">
  558. <!-- -->
  559. </a>
  560. <ul class="blockList">
  561. <li class="blockList">
  562. <h4>setModifiers</h4>
  563. <pre class="methodSignature">public&nbsp;void&nbsp;setModifiers&#8203;(int&nbsp;mod)</pre>
  564. <div class="block">Sets the encoded modifiers of the method/constructor.
  565. <p>Changing the modifiers may cause a problem.
  566. For example, if a non-static method is changed to static,
  567. the method will be rejected by the bytecode verifier.</div>
  568. <dl>
  569. <dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
  570. <dd><code><a href="CtMember.html#setModifiers(int)">setModifiers</a></code>&nbsp;in class&nbsp;<code><a href="CtMember.html" title="class in javassist">CtMember</a></code></dd>
  571. <dt><span class="seeLabel">See Also:</span></dt>
  572. <dd><a href="Modifier.html" title="class in javassist"><code>Modifier</code></a></dd>
  573. </dl>
  574. </li>
  575. </ul>
  576. <a id="hasAnnotation(java.lang.String)">
  577. <!-- -->
  578. </a>
  579. <ul class="blockList">
  580. <li class="blockList">
  581. <h4>hasAnnotation</h4>
  582. <pre class="methodSignature">public&nbsp;boolean&nbsp;hasAnnotation&#8203;(java.lang.String&nbsp;typeName)</pre>
  583. <div class="block">Returns true if the class has the specified annotation type.</div>
  584. <dl>
  585. <dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
  586. <dd><code><a href="CtMember.html#hasAnnotation(java.lang.String)">hasAnnotation</a></code>&nbsp;in class&nbsp;<code><a href="CtMember.html" title="class in javassist">CtMember</a></code></dd>
  587. <dt><span class="paramLabel">Parameters:</span></dt>
  588. <dd><code>typeName</code> - the name of annotation type.</dd>
  589. <dt><span class="returnLabel">Returns:</span></dt>
  590. <dd><code>true</code> if the annotation is found,
  591. otherwise <code>false</code>.</dd>
  592. <dt><span class="simpleTagLabel">Since:</span></dt>
  593. <dd>3.21</dd>
  594. </dl>
  595. </li>
  596. </ul>
  597. <a id="getAnnotation(java.lang.Class)">
  598. <!-- -->
  599. </a>
  600. <ul class="blockList">
  601. <li class="blockList">
  602. <h4>getAnnotation</h4>
  603. <pre class="methodSignature">public&nbsp;java.lang.Object&nbsp;getAnnotation&#8203;(java.lang.Class&lt;?&gt;&nbsp;clz)
  604. throws java.lang.ClassNotFoundException</pre>
  605. <div class="block">Returns the annotation if the class has the specified annotation class.
  606. For example, if an annotation <code>@Author</code> is associated
  607. with this method/constructor, an <code>Author</code> object is returned.
  608. The member values can be obtained by calling methods on
  609. the <code>Author</code> object.</div>
  610. <dl>
  611. <dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
  612. <dd><code><a href="CtMember.html#getAnnotation(java.lang.Class)">getAnnotation</a></code>&nbsp;in class&nbsp;<code><a href="CtMember.html" title="class in javassist">CtMember</a></code></dd>
  613. <dt><span class="paramLabel">Parameters:</span></dt>
  614. <dd><code>clz</code> - the annotation class.</dd>
  615. <dt><span class="returnLabel">Returns:</span></dt>
  616. <dd>the annotation if found, otherwise <code>null</code>.</dd>
  617. <dt><span class="throwsLabel">Throws:</span></dt>
  618. <dd><code>java.lang.ClassNotFoundException</code></dd>
  619. <dt><span class="simpleTagLabel">Since:</span></dt>
  620. <dd>3.11</dd>
  621. </dl>
  622. </li>
  623. </ul>
  624. <a id="getAnnotations()">
  625. <!-- -->
  626. </a>
  627. <ul class="blockList">
  628. <li class="blockList">
  629. <h4>getAnnotations</h4>
  630. <pre class="methodSignature">public&nbsp;java.lang.Object[]&nbsp;getAnnotations()
  631. throws java.lang.ClassNotFoundException</pre>
  632. <div class="block">Returns the annotations associated with this method or constructor.</div>
  633. <dl>
  634. <dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
  635. <dd><code><a href="CtMember.html#getAnnotations()">getAnnotations</a></code>&nbsp;in class&nbsp;<code><a href="CtMember.html" title="class in javassist">CtMember</a></code></dd>
  636. <dt><span class="returnLabel">Returns:</span></dt>
  637. <dd>an array of annotation-type objects.</dd>
  638. <dt><span class="throwsLabel">Throws:</span></dt>
  639. <dd><code>java.lang.ClassNotFoundException</code></dd>
  640. <dt><span class="simpleTagLabel">Since:</span></dt>
  641. <dd>3.1</dd>
  642. <dt><span class="seeLabel">See Also:</span></dt>
  643. <dd><a href="#getAvailableAnnotations()"><code>getAvailableAnnotations()</code></a></dd>
  644. </dl>
  645. </li>
  646. </ul>
  647. <a id="getAvailableAnnotations()">
  648. <!-- -->
  649. </a>
  650. <ul class="blockList">
  651. <li class="blockList">
  652. <h4>getAvailableAnnotations</h4>
  653. <pre class="methodSignature">public&nbsp;java.lang.Object[]&nbsp;getAvailableAnnotations()</pre>
  654. <div class="block">Returns the annotations associated with this method or constructor.
  655. If any annotations are not on the classpath, they are not included
  656. in the returned array.</div>
  657. <dl>
  658. <dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
  659. <dd><code><a href="CtMember.html#getAvailableAnnotations()">getAvailableAnnotations</a></code>&nbsp;in class&nbsp;<code><a href="CtMember.html" title="class in javassist">CtMember</a></code></dd>
  660. <dt><span class="returnLabel">Returns:</span></dt>
  661. <dd>an array of annotation-type objects.</dd>
  662. <dt><span class="simpleTagLabel">Since:</span></dt>
  663. <dd>3.3</dd>
  664. <dt><span class="seeLabel">See Also:</span></dt>
  665. <dd><a href="#getAnnotations()"><code>getAnnotations()</code></a></dd>
  666. </dl>
  667. </li>
  668. </ul>
  669. <a id="getParameterAnnotations()">
  670. <!-- -->
  671. </a>
  672. <ul class="blockList">
  673. <li class="blockList">
  674. <h4>getParameterAnnotations</h4>
  675. <pre class="methodSignature">public&nbsp;java.lang.Object[][]&nbsp;getParameterAnnotations()
  676. throws java.lang.ClassNotFoundException</pre>
  677. <div class="block">Returns the parameter annotations associated with this method or constructor.</div>
  678. <dl>
  679. <dt><span class="returnLabel">Returns:</span></dt>
  680. <dd>an array of annotation-type objects. The length of the returned array is
  681. equal to the number of the formal parameters. If each parameter has no
  682. annotation, the elements of the returned array are empty arrays.</dd>
  683. <dt><span class="throwsLabel">Throws:</span></dt>
  684. <dd><code>java.lang.ClassNotFoundException</code></dd>
  685. <dt><span class="simpleTagLabel">Since:</span></dt>
  686. <dd>3.1</dd>
  687. <dt><span class="seeLabel">See Also:</span></dt>
  688. <dd><a href="#getAvailableParameterAnnotations()"><code>getAvailableParameterAnnotations()</code></a>,
  689. <a href="#getAnnotations()"><code>getAnnotations()</code></a></dd>
  690. </dl>
  691. </li>
  692. </ul>
  693. <a id="getAvailableParameterAnnotations()">
  694. <!-- -->
  695. </a>
  696. <ul class="blockList">
  697. <li class="blockList">
  698. <h4>getAvailableParameterAnnotations</h4>
  699. <pre class="methodSignature">public&nbsp;java.lang.Object[][]&nbsp;getAvailableParameterAnnotations()</pre>
  700. <div class="block">Returns the parameter annotations associated with this method or constructor.
  701. If any annotations are not on the classpath, they are not included in the
  702. returned array.</div>
  703. <dl>
  704. <dt><span class="returnLabel">Returns:</span></dt>
  705. <dd>an array of annotation-type objects. The length of the returned array is
  706. equal to the number of the formal parameters. If each parameter has no
  707. annotation, the elements of the returned array are empty arrays.</dd>
  708. <dt><span class="simpleTagLabel">Since:</span></dt>
  709. <dd>3.3</dd>
  710. <dt><span class="seeLabel">See Also:</span></dt>
  711. <dd><a href="#getParameterAnnotations()"><code>getParameterAnnotations()</code></a>,
  712. <a href="#getAvailableAnnotations()"><code>getAvailableAnnotations()</code></a></dd>
  713. </dl>
  714. </li>
  715. </ul>
  716. <a id="getParameterTypes()">
  717. <!-- -->
  718. </a>
  719. <ul class="blockList">
  720. <li class="blockList">
  721. <h4>getParameterTypes</h4>
  722. <pre class="methodSignature">public&nbsp;<a href="CtClass.html" title="class in javassist">CtClass</a>[]&nbsp;getParameterTypes()
  723. throws <a href="NotFoundException.html" title="class in javassist">NotFoundException</a></pre>
  724. <div class="block">Obtains parameter types of this method/constructor.</div>
  725. <dl>
  726. <dt><span class="throwsLabel">Throws:</span></dt>
  727. <dd><code><a href="NotFoundException.html" title="class in javassist">NotFoundException</a></code></dd>
  728. </dl>
  729. </li>
  730. </ul>
  731. <a id="getSignature()">
  732. <!-- -->
  733. </a>
  734. <ul class="blockList">
  735. <li class="blockList">
  736. <h4>getSignature</h4>
  737. <pre class="methodSignature">public&nbsp;java.lang.String&nbsp;getSignature()</pre>
  738. <div class="block">Returns the method signature (the parameter types
  739. and the return type).
  740. The method signature is represented by a character string
  741. called method descriptor, which is defined in the JVM specification.
  742. If two methods/constructors have
  743. the same parameter types
  744. and the return type, <code>getSignature()</code> returns the
  745. same string (the return type of constructors is <code>void</code>).
  746. <p>Note that the returned string is not the type signature
  747. contained in the <code>SignatureAttirbute</code>. It is
  748. a descriptor.</div>
  749. <dl>
  750. <dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
  751. <dd><code><a href="CtMember.html#getSignature()">getSignature</a></code>&nbsp;in class&nbsp;<code><a href="CtMember.html" title="class in javassist">CtMember</a></code></dd>
  752. <dt><span class="seeLabel">See Also:</span></dt>
  753. <dd><a href="bytecode/Descriptor.html" title="class in javassist.bytecode"><code>Descriptor</code></a>,
  754. <a href="#getGenericSignature()"><code>getGenericSignature()</code></a></dd>
  755. </dl>
  756. </li>
  757. </ul>
  758. <a id="getGenericSignature()">
  759. <!-- -->
  760. </a>
  761. <ul class="blockList">
  762. <li class="blockList">
  763. <h4>getGenericSignature</h4>
  764. <pre class="methodSignature">public&nbsp;java.lang.String&nbsp;getGenericSignature()</pre>
  765. <div class="block">Returns the generic signature of the method.
  766. It represents parameter types including type variables.</div>
  767. <dl>
  768. <dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
  769. <dd><code><a href="CtMember.html#getGenericSignature()">getGenericSignature</a></code>&nbsp;in class&nbsp;<code><a href="CtMember.html" title="class in javassist">CtMember</a></code></dd>
  770. <dt><span class="simpleTagLabel">Since:</span></dt>
  771. <dd>3.17</dd>
  772. <dt><span class="seeLabel">See Also:</span></dt>
  773. <dd><a href="bytecode/SignatureAttribute.html#toMethodSignature(java.lang.String)"><code>SignatureAttribute.toMethodSignature(String)</code></a></dd>
  774. </dl>
  775. </li>
  776. </ul>
  777. <a id="setGenericSignature(java.lang.String)">
  778. <!-- -->
  779. </a>
  780. <ul class="blockList">
  781. <li class="blockList">
  782. <h4>setGenericSignature</h4>
  783. <pre class="methodSignature">public&nbsp;void&nbsp;setGenericSignature&#8203;(java.lang.String&nbsp;sig)</pre>
  784. <div class="block">Set the generic signature of the method.
  785. It represents parameter types including type variables.
  786. See <a href="CtClass.html#setGenericSignature(java.lang.String)"><code>CtClass.setGenericSignature(String)</code></a>
  787. for a code sample.</div>
  788. <dl>
  789. <dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
  790. <dd><code><a href="CtMember.html#setGenericSignature(java.lang.String)">setGenericSignature</a></code>&nbsp;in class&nbsp;<code><a href="CtMember.html" title="class in javassist">CtMember</a></code></dd>
  791. <dt><span class="paramLabel">Parameters:</span></dt>
  792. <dd><code>sig</code> - a new generic signature.</dd>
  793. <dt><span class="simpleTagLabel">Since:</span></dt>
  794. <dd>3.17</dd>
  795. <dt><span class="seeLabel">See Also:</span></dt>
  796. <dd><a href="bytecode/SignatureAttribute.MethodSignature.html#encode()"><code>SignatureAttribute.MethodSignature.encode()</code></a></dd>
  797. </dl>
  798. </li>
  799. </ul>
  800. <a id="getExceptionTypes()">
  801. <!-- -->
  802. </a>
  803. <ul class="blockList">
  804. <li class="blockList">
  805. <h4>getExceptionTypes</h4>
  806. <pre class="methodSignature">public&nbsp;<a href="CtClass.html" title="class in javassist">CtClass</a>[]&nbsp;getExceptionTypes()
  807. throws <a href="NotFoundException.html" title="class in javassist">NotFoundException</a></pre>
  808. <div class="block">Obtains exceptions that this method/constructor may throw.</div>
  809. <dl>
  810. <dt><span class="returnLabel">Returns:</span></dt>
  811. <dd>a zero-length array if there is no throws clause.</dd>
  812. <dt><span class="throwsLabel">Throws:</span></dt>
  813. <dd><code><a href="NotFoundException.html" title="class in javassist">NotFoundException</a></code></dd>
  814. </dl>
  815. </li>
  816. </ul>
  817. <a id="setExceptionTypes(javassist.CtClass[])">
  818. <!-- -->
  819. </a>
  820. <ul class="blockList">
  821. <li class="blockList">
  822. <h4>setExceptionTypes</h4>
  823. <pre class="methodSignature">public&nbsp;void&nbsp;setExceptionTypes&#8203;(<a href="CtClass.html" title="class in javassist">CtClass</a>[]&nbsp;types)
  824. throws <a href="NotFoundException.html" title="class in javassist">NotFoundException</a></pre>
  825. <div class="block">Sets exceptions that this method/constructor may throw.</div>
  826. <dl>
  827. <dt><span class="throwsLabel">Throws:</span></dt>
  828. <dd><code><a href="NotFoundException.html" title="class in javassist">NotFoundException</a></code></dd>
  829. </dl>
  830. </li>
  831. </ul>
  832. <a id="isEmpty()">
  833. <!-- -->
  834. </a>
  835. <ul class="blockList">
  836. <li class="blockList">
  837. <h4>isEmpty</h4>
  838. <pre class="methodSignature">public abstract&nbsp;boolean&nbsp;isEmpty()</pre>
  839. <div class="block">Returns true if the body is empty.</div>
  840. </li>
  841. </ul>
  842. <a id="setBody(java.lang.String)">
  843. <!-- -->
  844. </a>
  845. <ul class="blockList">
  846. <li class="blockList">
  847. <h4>setBody</h4>
  848. <pre class="methodSignature">public&nbsp;void&nbsp;setBody&#8203;(java.lang.String&nbsp;src)
  849. throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
  850. <div class="block">Sets a method/constructor body.</div>
  851. <dl>
  852. <dt><span class="paramLabel">Parameters:</span></dt>
  853. <dd><code>src</code> - the source code representing the body.
  854. It must be a single statement or block.
  855. If it is <code>null</code>, the substituted
  856. body does nothing except returning zero or null.</dd>
  857. <dt><span class="throwsLabel">Throws:</span></dt>
  858. <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
  859. </dl>
  860. </li>
  861. </ul>
  862. <a id="setBody(java.lang.String,java.lang.String,java.lang.String)">
  863. <!-- -->
  864. </a>
  865. <ul class="blockList">
  866. <li class="blockList">
  867. <h4>setBody</h4>
  868. <pre class="methodSignature">public&nbsp;void&nbsp;setBody&#8203;(java.lang.String&nbsp;src,
  869. java.lang.String&nbsp;delegateObj,
  870. java.lang.String&nbsp;delegateMethod)
  871. throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
  872. <div class="block">Sets a method/constructor body.</div>
  873. <dl>
  874. <dt><span class="paramLabel">Parameters:</span></dt>
  875. <dd><code>src</code> - the source code representing the body.
  876. It must be a single statement or block.
  877. If it is <code>null</code>, the substituted
  878. body does nothing except returning zero or null.</dd>
  879. <dd><code>delegateObj</code> - the source text specifying the object
  880. that is called on by <code>$proceed()</code>.</dd>
  881. <dd><code>delegateMethod</code> - the name of the method
  882. that is called by <code>$proceed()</code>.</dd>
  883. <dt><span class="throwsLabel">Throws:</span></dt>
  884. <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
  885. </dl>
  886. </li>
  887. </ul>
  888. <a id="getAttribute(java.lang.String)">
  889. <!-- -->
  890. </a>
  891. <ul class="blockList">
  892. <li class="blockList">
  893. <h4>getAttribute</h4>
  894. <pre class="methodSignature">public&nbsp;byte[]&nbsp;getAttribute&#8203;(java.lang.String&nbsp;name)</pre>
  895. <div class="block">Obtains an attribute with the given name.
  896. If that attribute is not found in the class file, this
  897. method returns null.
  898. <p>Note that an attribute is a data block specified by
  899. the class file format. It is not an annotation.
  900. See <a href="bytecode/AttributeInfo.html" title="class in javassist.bytecode"><code>AttributeInfo</code></a>.</div>
  901. <dl>
  902. <dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
  903. <dd><code><a href="CtMember.html#getAttribute(java.lang.String)">getAttribute</a></code>&nbsp;in class&nbsp;<code><a href="CtMember.html" title="class in javassist">CtMember</a></code></dd>
  904. <dt><span class="paramLabel">Parameters:</span></dt>
  905. <dd><code>name</code> - attribute name</dd>
  906. </dl>
  907. </li>
  908. </ul>
  909. <a id="setAttribute(java.lang.String,byte[])">
  910. <!-- -->
  911. </a>
  912. <ul class="blockList">
  913. <li class="blockList">
  914. <h4>setAttribute</h4>
  915. <pre class="methodSignature">public&nbsp;void&nbsp;setAttribute&#8203;(java.lang.String&nbsp;name,
  916. byte[]&nbsp;data)</pre>
  917. <div class="block">Adds an attribute. The attribute is saved in the class file.
  918. <p>Note that an attribute is a data block specified by
  919. the class file format. It is not an annotation.
  920. See <a href="bytecode/AttributeInfo.html" title="class in javassist.bytecode"><code>AttributeInfo</code></a>.</div>
  921. <dl>
  922. <dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
  923. <dd><code><a href="CtMember.html#setAttribute(java.lang.String,byte%5B%5D)">setAttribute</a></code>&nbsp;in class&nbsp;<code><a href="CtMember.html" title="class in javassist">CtMember</a></code></dd>
  924. <dt><span class="paramLabel">Parameters:</span></dt>
  925. <dd><code>name</code> - attribute name</dd>
  926. <dd><code>data</code> - attribute value</dd>
  927. </dl>
  928. </li>
  929. </ul>
  930. <a id="useCflow(java.lang.String)">
  931. <!-- -->
  932. </a>
  933. <ul class="blockList">
  934. <li class="blockList">
  935. <h4>useCflow</h4>
  936. <pre class="methodSignature">public&nbsp;void&nbsp;useCflow&#8203;(java.lang.String&nbsp;name)
  937. throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
  938. <div class="block">Declares to use <code>$cflow</code> for this method/constructor.
  939. If <code>$cflow</code> is used, the class files modified
  940. with Javassist requires a support class
  941. <code>javassist.runtime.Cflow</code> at runtime
  942. (other Javassist classes are not required at runtime).
  943. <p>Every <code>$cflow</code> variable is given a unique name.
  944. For example, if the given name is <code>"Point.paint"</code>,
  945. then the variable is indicated by <code>$cflow(Point.paint)</code>.</div>
  946. <dl>
  947. <dt><span class="paramLabel">Parameters:</span></dt>
  948. <dd><code>name</code> - <code>$cflow</code> name. It can include
  949. alphabets, numbers, <code>_</code>,
  950. <code>$</code>, and <code>.</code> (dot).</dd>
  951. <dt><span class="throwsLabel">Throws:</span></dt>
  952. <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
  953. <dt><span class="seeLabel">See Also:</span></dt>
  954. <dd><a href="runtime/Cflow.html" title="class in javassist.runtime"><code>Cflow</code></a></dd>
  955. </dl>
  956. </li>
  957. </ul>
  958. <a id="addLocalVariable(java.lang.String,javassist.CtClass)">
  959. <!-- -->
  960. </a>
  961. <ul class="blockList">
  962. <li class="blockList">
  963. <h4>addLocalVariable</h4>
  964. <pre class="methodSignature">public&nbsp;void&nbsp;addLocalVariable&#8203;(java.lang.String&nbsp;name,
  965. <a href="CtClass.html" title="class in javassist">CtClass</a>&nbsp;type)
  966. throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
  967. <div class="block">Declares a new local variable. The scope of this variable is the
  968. whole method body. The initial value of that variable is not set.
  969. The declared variable can be accessed in the code snippet inserted
  970. by <code>insertBefore()</code>, <code>insertAfter()</code>, etc.
  971. <p>If the second parameter <code>asFinally</code> to
  972. <code>insertAfter()</code> is true, the declared local variable
  973. is not visible from the code inserted by <code>insertAfter()</code>.</div>
  974. <dl>
  975. <dt><span class="paramLabel">Parameters:</span></dt>
  976. <dd><code>name</code> - the name of the variable</dd>
  977. <dd><code>type</code> - the type of the variable</dd>
  978. <dt><span class="throwsLabel">Throws:</span></dt>
  979. <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
  980. <dt><span class="seeLabel">See Also:</span></dt>
  981. <dd><a href="#insertBefore(java.lang.String)"><code>insertBefore(String)</code></a>,
  982. <a href="#insertAfter(java.lang.String)"><code>insertAfter(String)</code></a></dd>
  983. </dl>
  984. </li>
  985. </ul>
  986. <a id="insertParameter(javassist.CtClass)">
  987. <!-- -->
  988. </a>
  989. <ul class="blockList">
  990. <li class="blockList">
  991. <h4>insertParameter</h4>
  992. <pre class="methodSignature">public&nbsp;void&nbsp;insertParameter&#8203;(<a href="CtClass.html" title="class in javassist">CtClass</a>&nbsp;type)
  993. throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
  994. <div class="block">Inserts a new parameter, which becomes the first parameter.</div>
  995. <dl>
  996. <dt><span class="throwsLabel">Throws:</span></dt>
  997. <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
  998. </dl>
  999. </li>
  1000. </ul>
  1001. <a id="addParameter(javassist.CtClass)">
  1002. <!-- -->
  1003. </a>
  1004. <ul class="blockList">
  1005. <li class="blockList">
  1006. <h4>addParameter</h4>
  1007. <pre class="methodSignature">public&nbsp;void&nbsp;addParameter&#8203;(<a href="CtClass.html" title="class in javassist">CtClass</a>&nbsp;type)
  1008. throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
  1009. <div class="block">Appends a new parameter, which becomes the last parameter.</div>
  1010. <dl>
  1011. <dt><span class="throwsLabel">Throws:</span></dt>
  1012. <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
  1013. </dl>
  1014. </li>
  1015. </ul>
  1016. <a id="instrument(javassist.CodeConverter)">
  1017. <!-- -->
  1018. </a>
  1019. <ul class="blockList">
  1020. <li class="blockList">
  1021. <h4>instrument</h4>
  1022. <pre class="methodSignature">public&nbsp;void&nbsp;instrument&#8203;(<a href="CodeConverter.html" title="class in javassist">CodeConverter</a>&nbsp;converter)
  1023. throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
  1024. <div class="block">Modifies the method/constructor body.</div>
  1025. <dl>
  1026. <dt><span class="paramLabel">Parameters:</span></dt>
  1027. <dd><code>converter</code> - specifies how to modify.</dd>
  1028. <dt><span class="throwsLabel">Throws:</span></dt>
  1029. <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
  1030. </dl>
  1031. </li>
  1032. </ul>
  1033. <a id="instrument(javassist.expr.ExprEditor)">
  1034. <!-- -->
  1035. </a>
  1036. <ul class="blockList">
  1037. <li class="blockList">
  1038. <h4>instrument</h4>
  1039. <pre class="methodSignature">public&nbsp;void&nbsp;instrument&#8203;(<a href="expr/ExprEditor.html" title="class in javassist.expr">ExprEditor</a>&nbsp;editor)
  1040. throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
  1041. <div class="block">Modifies the method/constructor body.
  1042. <p>While executing this method, only <code>replace()</code>
  1043. in <code>Expr</code> is available for bytecode modification.
  1044. Other methods such as <code>insertBefore()</code> may collapse
  1045. the bytecode because the <code>ExprEditor</code> loses
  1046. its current position.</div>
  1047. <dl>
  1048. <dt><span class="paramLabel">Parameters:</span></dt>
  1049. <dd><code>editor</code> - specifies how to modify.</dd>
  1050. <dt><span class="throwsLabel">Throws:</span></dt>
  1051. <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
  1052. <dt><span class="seeLabel">See Also:</span></dt>
  1053. <dd><a href="expr/Expr.html#replace(java.lang.String)"><code>Expr.replace(String)</code></a>,
  1054. <a href="#insertBefore(java.lang.String)"><code>insertBefore(String)</code></a></dd>
  1055. </dl>
  1056. </li>
  1057. </ul>
  1058. <a id="insertBefore(java.lang.String)">
  1059. <!-- -->
  1060. </a>
  1061. <ul class="blockList">
  1062. <li class="blockList">
  1063. <h4>insertBefore</h4>
  1064. <pre class="methodSignature">public&nbsp;void&nbsp;insertBefore&#8203;(java.lang.String&nbsp;src)
  1065. throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
  1066. <div class="block">Inserts bytecode at the beginning of the body.
  1067. <p>If this object represents a constructor,
  1068. the bytecode is inserted before
  1069. a constructor in the super class or this class is called.
  1070. Therefore, the inserted bytecode is subject to constraints described
  1071. in Section 4.8.2 of The Java Virtual Machine Specification (2nd ed).
  1072. For example, it cannot access instance fields or methods although
  1073. it may assign a value to an instance field directly declared in this
  1074. class. Accessing static fields and methods is allowed.
  1075. Use <code>insertBeforeBody()</code> in <code>CtConstructor</code>.</div>
  1076. <dl>
  1077. <dt><span class="paramLabel">Parameters:</span></dt>
  1078. <dd><code>src</code> - the source code representing the inserted bytecode.
  1079. It must be a single statement or block.</dd>
  1080. <dt><span class="throwsLabel">Throws:</span></dt>
  1081. <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
  1082. <dt><span class="seeLabel">See Also:</span></dt>
  1083. <dd><a href="CtConstructor.html#insertBeforeBody(java.lang.String)"><code>CtConstructor.insertBeforeBody(String)</code></a></dd>
  1084. </dl>
  1085. </li>
  1086. </ul>
  1087. <a id="insertAfter(java.lang.String)">
  1088. <!-- -->
  1089. </a>
  1090. <ul class="blockList">
  1091. <li class="blockList">
  1092. <h4>insertAfter</h4>
  1093. <pre class="methodSignature">public&nbsp;void&nbsp;insertAfter&#8203;(java.lang.String&nbsp;src)
  1094. throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
  1095. <div class="block">Inserts bytecode at the end of the body.
  1096. The bytecode is inserted just before every return instruction.
  1097. It is not executed when an exception is thrown.</div>
  1098. <dl>
  1099. <dt><span class="paramLabel">Parameters:</span></dt>
  1100. <dd><code>src</code> - the source code representing the inserted bytecode.
  1101. It must be a single statement or block.</dd>
  1102. <dt><span class="throwsLabel">Throws:</span></dt>
  1103. <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
  1104. </dl>
  1105. </li>
  1106. </ul>
  1107. <a id="insertAfter(java.lang.String,boolean)">
  1108. <!-- -->
  1109. </a>
  1110. <ul class="blockList">
  1111. <li class="blockList">
  1112. <h4>insertAfter</h4>
  1113. <pre class="methodSignature">public&nbsp;void&nbsp;insertAfter&#8203;(java.lang.String&nbsp;src,
  1114. boolean&nbsp;asFinally)
  1115. throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
  1116. <div class="block">Inserts bytecode at the end of the body.
  1117. The bytecode is inserted just before every return instruction.</div>
  1118. <dl>
  1119. <dt><span class="paramLabel">Parameters:</span></dt>
  1120. <dd><code>src</code> - the source code representing the inserted bytecode.
  1121. It must be a single statement or block.</dd>
  1122. <dd><code>asFinally</code> - true if the inserted bytecode is executed
  1123. not only when the control normally returns
  1124. but also when an exception is thrown.
  1125. If this parameter is true, the inserted code cannot
  1126. access local variables.</dd>
  1127. <dt><span class="throwsLabel">Throws:</span></dt>
  1128. <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
  1129. </dl>
  1130. </li>
  1131. </ul>
  1132. <a id="insertAfter(java.lang.String,boolean,boolean)">
  1133. <!-- -->
  1134. </a>
  1135. <ul class="blockList">
  1136. <li class="blockList">
  1137. <h4>insertAfter</h4>
  1138. <pre class="methodSignature">public&nbsp;void&nbsp;insertAfter&#8203;(java.lang.String&nbsp;src,
  1139. boolean&nbsp;asFinally,
  1140. boolean&nbsp;redundant)
  1141. throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
  1142. <div class="block">Inserts bytecode at the end of the body.
  1143. The bytecode is inserted just before every return instruction.</div>
  1144. <dl>
  1145. <dt><span class="paramLabel">Parameters:</span></dt>
  1146. <dd><code>src</code> - the source code representing the inserted bytecode.
  1147. It must be a single statement or block.</dd>
  1148. <dd><code>asFinally</code> - true if the inserted bytecode is executed
  1149. not only when the control normally returns
  1150. but also when an exception is thrown.
  1151. If this parameter is true, the inserted code cannot
  1152. access local variables.</dd>
  1153. <dd><code>redundant</code> - if true, redundant bytecode will be generated.
  1154. the redundancy is necessary when some compilers (Kotlin?)
  1155. generate the original bytecode.
  1156. The other <code>insertAfter</code> methods calls this method
  1157. with <code>false</code> for this parameter.
  1158. A tip is to pass <code>this.getDeclaringClass().isKotlin()</code>
  1159. to this parameter.</dd>
  1160. <dt><span class="throwsLabel">Throws:</span></dt>
  1161. <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
  1162. <dt><span class="simpleTagLabel">Since:</span></dt>
  1163. <dd>3.26</dd>
  1164. <dt><span class="seeLabel">See Also:</span></dt>
  1165. <dd><a href="CtClass.html#isKotlin()"><code>CtClass.isKotlin()</code></a>,
  1166. <a href="CtMember.html#getDeclaringClass()"><code>CtMember.getDeclaringClass()</code></a></dd>
  1167. </dl>
  1168. </li>
  1169. </ul>
  1170. <a id="addCatch(java.lang.String,javassist.CtClass)">
  1171. <!-- -->
  1172. </a>
  1173. <ul class="blockList">
  1174. <li class="blockList">
  1175. <h4>addCatch</h4>
  1176. <pre class="methodSignature">public&nbsp;void&nbsp;addCatch&#8203;(java.lang.String&nbsp;src,
  1177. <a href="CtClass.html" title="class in javassist">CtClass</a>&nbsp;exceptionType)
  1178. throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
  1179. <div class="block">Adds a catch clause that handles an exception thrown in the
  1180. body. The catch clause must end with a return or throw statement.</div>
  1181. <dl>
  1182. <dt><span class="paramLabel">Parameters:</span></dt>
  1183. <dd><code>src</code> - the source code representing the catch clause.
  1184. It must be a single statement or block.</dd>
  1185. <dd><code>exceptionType</code> - the type of the exception handled by the
  1186. catch clause.</dd>
  1187. <dt><span class="throwsLabel">Throws:</span></dt>
  1188. <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
  1189. </dl>
  1190. </li>
  1191. </ul>
  1192. <a id="addCatch(java.lang.String,javassist.CtClass,java.lang.String)">
  1193. <!-- -->
  1194. </a>
  1195. <ul class="blockList">
  1196. <li class="blockList">
  1197. <h4>addCatch</h4>
  1198. <pre class="methodSignature">public&nbsp;void&nbsp;addCatch&#8203;(java.lang.String&nbsp;src,
  1199. <a href="CtClass.html" title="class in javassist">CtClass</a>&nbsp;exceptionType,
  1200. java.lang.String&nbsp;exceptionName)
  1201. throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
  1202. <div class="block">Adds a catch clause that handles an exception thrown in the
  1203. body. The catch clause must end with a return or throw statement.</div>
  1204. <dl>
  1205. <dt><span class="paramLabel">Parameters:</span></dt>
  1206. <dd><code>src</code> - the source code representing the catch clause.
  1207. It must be a single statement or block.</dd>
  1208. <dd><code>exceptionType</code> - the type of the exception handled by the
  1209. catch clause.</dd>
  1210. <dd><code>exceptionName</code> - the name of the variable containing the
  1211. caught exception, for example,
  1212. <code>$e</code>.</dd>
  1213. <dt><span class="throwsLabel">Throws:</span></dt>
  1214. <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
  1215. </dl>
  1216. </li>
  1217. </ul>
  1218. <a id="insertAt(int,java.lang.String)">
  1219. <!-- -->
  1220. </a>
  1221. <ul class="blockList">
  1222. <li class="blockList">
  1223. <h4>insertAt</h4>
  1224. <pre class="methodSignature">public&nbsp;int&nbsp;insertAt&#8203;(int&nbsp;lineNum,
  1225. java.lang.String&nbsp;src)
  1226. throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
  1227. <div class="block">Inserts bytecode at the specified line in the body.
  1228. It is equivalent to:
  1229. <br><code>insertAt(lineNum, true, src)</code>
  1230. <br>See this method as well.</div>
  1231. <dl>
  1232. <dt><span class="paramLabel">Parameters:</span></dt>
  1233. <dd><code>lineNum</code> - the line number. The bytecode is inserted at the
  1234. beginning of the code at the line specified by this
  1235. line number.</dd>
  1236. <dd><code>src</code> - the source code representing the inserted bytecode.
  1237. It must be a single statement or block.</dd>
  1238. <dt><span class="returnLabel">Returns:</span></dt>
  1239. <dd>the line number at which the bytecode has been inserted.</dd>
  1240. <dt><span class="throwsLabel">Throws:</span></dt>
  1241. <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
  1242. <dt><span class="seeLabel">See Also:</span></dt>
  1243. <dd><a href="#insertAt(int,boolean,java.lang.String)"><code>insertAt(int,boolean,String)</code></a></dd>
  1244. </dl>
  1245. </li>
  1246. </ul>
  1247. <a id="insertAt(int,boolean,java.lang.String)">
  1248. <!-- -->
  1249. </a>
  1250. <ul class="blockListLast">
  1251. <li class="blockList">
  1252. <h4>insertAt</h4>
  1253. <pre class="methodSignature">public&nbsp;int&nbsp;insertAt&#8203;(int&nbsp;lineNum,
  1254. boolean&nbsp;modify,
  1255. java.lang.String&nbsp;src)
  1256. throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
  1257. <div class="block">Inserts bytecode at the specified line in the body.
  1258. <p>If there is not
  1259. a statement at the specified line, the bytecode might be inserted
  1260. at the line including the first statement after that line specified.
  1261. For example, if there is only a closing brace at that line, the
  1262. bytecode would be inserted at another line below.
  1263. To know exactly where the bytecode will be inserted, call with
  1264. <code>modify</code> set to <code>false</code>.</div>
  1265. <dl>
  1266. <dt><span class="paramLabel">Parameters:</span></dt>
  1267. <dd><code>lineNum</code> - the line number. The bytecode is inserted at the
  1268. beginning of the code at the line specified by this
  1269. line number.</dd>
  1270. <dd><code>modify</code> - if false, this method does not insert the bytecode.
  1271. It instead only returns the line number at which
  1272. the bytecode would be inserted.</dd>
  1273. <dd><code>src</code> - the source code representing the inserted bytecode.
  1274. It must be a single statement or block.
  1275. If modify is false, the value of src can be null.</dd>
  1276. <dt><span class="returnLabel">Returns:</span></dt>
  1277. <dd>the line number at which the bytecode has been inserted.</dd>
  1278. <dt><span class="throwsLabel">Throws:</span></dt>
  1279. <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
  1280. </dl>
  1281. </li>
  1282. </ul>
  1283. </li>
  1284. </ul>
  1285. </section>
  1286. </li>
  1287. </ul>
  1288. </div>
  1289. </div>
  1290. </main>
  1291. <!-- ========= END OF CLASS DATA ========= -->
  1292. <footer role="contentinfo">
  1293. <nav role="navigation">
  1294. <!-- ======= START OF BOTTOM NAVBAR ====== -->
  1295. <div class="bottomNav"><a id="navbar.bottom">
  1296. <!-- -->
  1297. </a>
  1298. <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
  1299. <a id="navbar.bottom.firstrow">
  1300. <!-- -->
  1301. </a>
  1302. <ul class="navList" title="Navigation">
  1303. <li><a href="../index.html">Overview</a></li>
  1304. <li><a href="package-summary.html">Package</a></li>
  1305. <li class="navBarCell1Rev">Class</li>
  1306. <li><a href="class-use/CtBehavior.html">Use</a></li>
  1307. <li><a href="package-tree.html">Tree</a></li>
  1308. <li><a href="../deprecated-list.html">Deprecated</a></li>
  1309. <li><a href="../index-all.html">Index</a></li>
  1310. </ul>
  1311. </div>
  1312. <div class="subNav">
  1313. <ul class="navList" id="allclasses_navbar_bottom">
  1314. <li><a href="../allclasses.html">All&nbsp;Classes</a></li>
  1315. </ul>
  1316. <div>
  1317. <script type="text/javascript"><!--
  1318. allClassesLink = document.getElementById("allclasses_navbar_bottom");
  1319. if(window==top) {
  1320. allClassesLink.style.display = "block";
  1321. }
  1322. else {
  1323. allClassesLink.style.display = "none";
  1324. }
  1325. //-->
  1326. </script>
  1327. <noscript>
  1328. <div>JavaScript is disabled on your browser.</div>
  1329. </noscript>
  1330. </div>
  1331. <div>
  1332. <ul class="subNavList">
  1333. <li>Summary:&nbsp;</li>
  1334. <li>Nested&nbsp;|&nbsp;</li>
  1335. <li>Field&nbsp;|&nbsp;</li>
  1336. <li>Constr&nbsp;|&nbsp;</li>
  1337. <li><a href="#method.summary">Method</a></li>
  1338. </ul>
  1339. <ul class="subNavList">
  1340. <li>Detail:&nbsp;</li>
  1341. <li>Field&nbsp;|&nbsp;</li>
  1342. <li>Constr&nbsp;|&nbsp;</li>
  1343. <li><a href="#method.detail">Method</a></li>
  1344. </ul>
  1345. </div>
  1346. <a id="skip.navbar.bottom">
  1347. <!-- -->
  1348. </a></div>
  1349. <!-- ======== END OF BOTTOM NAVBAR ======= -->
  1350. </nav>
  1351. <p class="legalCopy"><small><i>Javassist, a Java-bytecode translator toolkit.<br>
  1352. Copyright (C) 1999- Shigeru Chiba. All Rights Reserved.</i></small></p>
  1353. </footer>
  1354. </body>
  1355. </html>