12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370 |
- <!DOCTYPE HTML>
- <!-- NewPage -->
- <html lang="en">
- <head>
- <!-- Generated by javadoc (11) on Sat May 08 11:16:00 JST 2021 -->
- <title>CtBehavior (Javassist API)</title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <meta name="dc.created" content="2021-05-08">
- <link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style">
- <link rel="stylesheet" type="text/css" href="../jquery/jquery-ui.css" title="Style">
- <script type="text/javascript" src="../script.js"></script>
- <script type="text/javascript" src="../jquery/jszip/dist/jszip.min.js"></script>
- <script type="text/javascript" src="../jquery/jszip-utils/dist/jszip-utils.min.js"></script>
- <!--[if IE]>
- <script type="text/javascript" src="../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script>
- <![endif]-->
- <script type="text/javascript" src="../jquery/jquery-3.3.1.js"></script>
- <script type="text/javascript" src="../jquery/jquery-migrate-3.0.1.js"></script>
- <script type="text/javascript" src="../jquery/jquery-ui.js"></script>
- </head>
- <body>
- <script type="text/javascript"><!--
- try {
- if (location.href.indexOf('is-external=true') == -1) {
- parent.document.title="CtBehavior (Javassist API)";
- }
- }
- catch(err) {
- }
- //-->
- 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};
- var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"],8:["t4","Concrete Methods"]};
- var altColor = "altColor";
- var rowColor = "rowColor";
- var tableTab = "tableTab";
- var activeTableTab = "activeTableTab";
- var pathtoroot = "../";
- var useModuleDirectories = true;
- loadScripts(document, 'script');</script>
- <noscript>
- <div>JavaScript is disabled on your browser.</div>
- </noscript>
- <header role="banner">
- <nav role="navigation">
- <div class="fixedNav">
- <!-- ========= START OF TOP NAVBAR ======= -->
- <div class="topNav"><a id="navbar.top">
- <!-- -->
- </a>
- <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
- <a id="navbar.top.firstrow">
- <!-- -->
- </a>
- <ul class="navList" title="Navigation">
- <li><a href="../index.html">Overview</a></li>
- <li><a href="package-summary.html">Package</a></li>
- <li class="navBarCell1Rev">Class</li>
- <li><a href="class-use/CtBehavior.html">Use</a></li>
- <li><a href="package-tree.html">Tree</a></li>
- <li><a href="../deprecated-list.html">Deprecated</a></li>
- <li><a href="../index-all.html">Index</a></li>
- </ul>
- </div>
- <div class="subNav">
- <ul class="navList" id="allclasses_navbar_top">
- <li><a href="../allclasses.html">All Classes</a></li>
- </ul>
- <ul class="navListSearch">
- <li><label for="search">SEARCH:</label>
- <input type="text" id="search" value="search" disabled="disabled">
- <input type="reset" id="reset" value="reset" disabled="disabled">
- </li>
- </ul>
- <div>
- <script type="text/javascript"><!--
- allClassesLink = document.getElementById("allclasses_navbar_top");
- if(window==top) {
- allClassesLink.style.display = "block";
- }
- else {
- allClassesLink.style.display = "none";
- }
- //-->
- </script>
- <noscript>
- <div>JavaScript is disabled on your browser.</div>
- </noscript>
- </div>
- <div>
- <ul class="subNavList">
- <li>Summary: </li>
- <li>Nested | </li>
- <li>Field | </li>
- <li>Constr | </li>
- <li><a href="#method.summary">Method</a></li>
- </ul>
- <ul class="subNavList">
- <li>Detail: </li>
- <li>Field | </li>
- <li>Constr | </li>
- <li><a href="#method.detail">Method</a></li>
- </ul>
- </div>
- <a id="skip.navbar.top">
- <!-- -->
- </a></div>
- <!-- ========= END OF TOP NAVBAR ========= -->
- </div>
- <div class="navPadding"> </div>
- <script type="text/javascript"><!--
- $('.navPadding').css('padding-top', $('.fixedNav').css("height"));
- //-->
- </script>
- </nav>
- </header>
- <!-- ======== START OF CLASS DATA ======== -->
- <main role="main">
- <div class="header">
- <div class="subTitle"><span class="packageLabelInType">Package</span> <a href="package-summary.html">javassist</a></div>
- <h2 title="Class CtBehavior" class="title">Class CtBehavior</h2>
- </div>
- <div class="contentContainer">
- <ul class="inheritance">
- <li>java.lang.Object</li>
- <li>
- <ul class="inheritance">
- <li><a href="CtMember.html" title="class in javassist">javassist.CtMember</a></li>
- <li>
- <ul class="inheritance">
- <li>javassist.CtBehavior</li>
- </ul>
- </li>
- </ul>
- </li>
- </ul>
- <div class="description">
- <ul class="blockList">
- <li class="blockList">
- <dl>
- <dt>Direct Known Subclasses:</dt>
- <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>
- </dl>
- <hr>
- <pre>public abstract class <span class="typeNameLabel">CtBehavior</span>
- extends <a href="CtMember.html" title="class in javassist">CtMember</a></pre>
- <div class="block"><code>CtBehavior</code> represents a method, a constructor,
- or a static constructor (class initializer).
- It is the abstract super class of
- <code>CtMethod</code> and <code>CtConstructor</code>.
-
- <p>To directly read or modify bytecode, obtain <code>MethodInfo</code>
- objects.</div>
- <dl>
- <dt><span class="seeLabel">See Also:</span></dt>
- <dd><a href="#getMethodInfo()"><code>getMethodInfo()</code></a></dd>
- </dl>
- </li>
- </ul>
- </div>
- <div class="summary">
- <ul class="blockList">
- <li class="blockList">
- <!-- ========== METHOD SUMMARY =========== -->
- <section role="region">
- <ul class="blockList">
- <li class="blockList"><a id="method.summary">
- <!-- -->
- </a>
- <h3>Method Summary</h3>
- <table class="memberSummary">
- <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption>
- <tr>
- <th class="colFirst" scope="col">Modifier and Type</th>
- <th class="colSecond" scope="col">Method</th>
- <th class="colLast" scope="col">Description</th>
- </tr>
- <tr id="i0" class="altColor">
- <td class="colFirst"><code>void</code></td>
- <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#addCatch(java.lang.String,javassist.CtClass)">addCatch</a></span>​(java.lang.String src,
- <a href="CtClass.html" title="class in javassist">CtClass</a> exceptionType)</code></th>
- <td class="colLast">
- <div class="block">Adds a catch clause that handles an exception thrown in the
- body.</div>
- </td>
- </tr>
- <tr id="i1" class="rowColor">
- <td class="colFirst"><code>void</code></td>
- <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#addCatch(java.lang.String,javassist.CtClass,java.lang.String)">addCatch</a></span>​(java.lang.String src,
- <a href="CtClass.html" title="class in javassist">CtClass</a> exceptionType,
- java.lang.String exceptionName)</code></th>
- <td class="colLast">
- <div class="block">Adds a catch clause that handles an exception thrown in the
- body.</div>
- </td>
- </tr>
- <tr id="i2" class="altColor">
- <td class="colFirst"><code>void</code></td>
- <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#addLocalVariable(java.lang.String,javassist.CtClass)">addLocalVariable</a></span>​(java.lang.String name,
- <a href="CtClass.html" title="class in javassist">CtClass</a> type)</code></th>
- <td class="colLast">
- <div class="block">Declares a new local variable.</div>
- </td>
- </tr>
- <tr id="i3" class="rowColor">
- <td class="colFirst"><code>void</code></td>
- <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#addParameter(javassist.CtClass)">addParameter</a></span>​(<a href="CtClass.html" title="class in javassist">CtClass</a> type)</code></th>
- <td class="colLast">
- <div class="block">Appends a new parameter, which becomes the last parameter.</div>
- </td>
- </tr>
- <tr id="i4" class="altColor">
- <td class="colFirst"><code>java.lang.Object</code></td>
- <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getAnnotation(java.lang.Class)">getAnnotation</a></span>​(java.lang.Class<?> clz)</code></th>
- <td class="colLast">
- <div class="block">Returns the annotation if the class has the specified annotation class.</div>
- </td>
- </tr>
- <tr id="i5" class="rowColor">
- <td class="colFirst"><code>java.lang.Object[]</code></td>
- <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getAnnotations()">getAnnotations</a></span>()</code></th>
- <td class="colLast">
- <div class="block">Returns the annotations associated with this method or constructor.</div>
- </td>
- </tr>
- <tr id="i6" class="altColor">
- <td class="colFirst"><code>byte[]</code></td>
- <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getAttribute(java.lang.String)">getAttribute</a></span>​(java.lang.String name)</code></th>
- <td class="colLast">
- <div class="block">Obtains an attribute with the given name.</div>
- </td>
- </tr>
- <tr id="i7" class="rowColor">
- <td class="colFirst"><code>java.lang.Object[]</code></td>
- <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getAvailableAnnotations()">getAvailableAnnotations</a></span>()</code></th>
- <td class="colLast">
- <div class="block">Returns the annotations associated with this method or constructor.</div>
- </td>
- </tr>
- <tr id="i8" class="altColor">
- <td class="colFirst"><code>java.lang.Object[][]</code></td>
- <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getAvailableParameterAnnotations()">getAvailableParameterAnnotations</a></span>()</code></th>
- <td class="colLast">
- <div class="block">Returns the parameter annotations associated with this method or constructor.</div>
- </td>
- </tr>
- <tr id="i9" class="rowColor">
- <td class="colFirst"><code><a href="CtClass.html" title="class in javassist">CtClass</a>[]</code></td>
- <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getExceptionTypes()">getExceptionTypes</a></span>()</code></th>
- <td class="colLast">
- <div class="block">Obtains exceptions that this method/constructor may throw.</div>
- </td>
- </tr>
- <tr id="i10" class="altColor">
- <td class="colFirst"><code>java.lang.String</code></td>
- <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getGenericSignature()">getGenericSignature</a></span>()</code></th>
- <td class="colLast">
- <div class="block">Returns the generic signature of the method.</div>
- </td>
- </tr>
- <tr id="i11" class="rowColor">
- <td class="colFirst"><code>abstract java.lang.String</code></td>
- <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getLongName()">getLongName</a></span>()</code></th>
- <td class="colLast">
- <div class="block">Returns the method or constructor name followed by parameter types
- such as <code>javassist.CtBehavior.stBody(String)</code>.</div>
- </td>
- </tr>
- <tr id="i12" class="altColor">
- <td class="colFirst"><code><a href="bytecode/MethodInfo.html" title="class in javassist.bytecode">MethodInfo</a></code></td>
- <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getMethodInfo()">getMethodInfo</a></span>()</code></th>
- <td class="colLast">
- <div class="block">Returns the <code>MethodInfo</code> representing this method/constructor in the
- class file.</div>
- </td>
- </tr>
- <tr id="i13" class="rowColor">
- <td class="colFirst"><code><a href="bytecode/MethodInfo.html" title="class in javassist.bytecode">MethodInfo</a></code></td>
- <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getMethodInfo2()">getMethodInfo2</a></span>()</code></th>
- <td class="colLast">
- <div class="block">Returns the <code>MethodInfo</code> representing the method/constructor in the
- class file (read only).</div>
- </td>
- </tr>
- <tr id="i14" class="altColor">
- <td class="colFirst"><code>int</code></td>
- <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getModifiers()">getModifiers</a></span>()</code></th>
- <td class="colLast">
- <div class="block">Obtains the modifiers of the method/constructor.</div>
- </td>
- </tr>
- <tr id="i15" class="rowColor">
- <td class="colFirst"><code>java.lang.Object[][]</code></td>
- <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getParameterAnnotations()">getParameterAnnotations</a></span>()</code></th>
- <td class="colLast">
- <div class="block">Returns the parameter annotations associated with this method or constructor.</div>
- </td>
- </tr>
- <tr id="i16" class="altColor">
- <td class="colFirst"><code><a href="CtClass.html" title="class in javassist">CtClass</a>[]</code></td>
- <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getParameterTypes()">getParameterTypes</a></span>()</code></th>
- <td class="colLast">
- <div class="block">Obtains parameter types of this method/constructor.</div>
- </td>
- </tr>
- <tr id="i17" class="rowColor">
- <td class="colFirst"><code>java.lang.String</code></td>
- <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getSignature()">getSignature</a></span>()</code></th>
- <td class="colLast">
- <div class="block">Returns the method signature (the parameter types
- and the return type).</div>
- </td>
- </tr>
- <tr id="i18" class="altColor">
- <td class="colFirst"><code>boolean</code></td>
- <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#hasAnnotation(java.lang.String)">hasAnnotation</a></span>​(java.lang.String typeName)</code></th>
- <td class="colLast">
- <div class="block">Returns true if the class has the specified annotation type.</div>
- </td>
- </tr>
- <tr id="i19" class="rowColor">
- <td class="colFirst"><code>void</code></td>
- <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#insertAfter(java.lang.String)">insertAfter</a></span>​(java.lang.String src)</code></th>
- <td class="colLast">
- <div class="block">Inserts bytecode at the end of the body.</div>
- </td>
- </tr>
- <tr id="i20" class="altColor">
- <td class="colFirst"><code>void</code></td>
- <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#insertAfter(java.lang.String,boolean)">insertAfter</a></span>​(java.lang.String src,
- boolean asFinally)</code></th>
- <td class="colLast">
- <div class="block">Inserts bytecode at the end of the body.</div>
- </td>
- </tr>
- <tr id="i21" class="rowColor">
- <td class="colFirst"><code>void</code></td>
- <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#insertAfter(java.lang.String,boolean,boolean)">insertAfter</a></span>​(java.lang.String src,
- boolean asFinally,
- boolean redundant)</code></th>
- <td class="colLast">
- <div class="block">Inserts bytecode at the end of the body.</div>
- </td>
- </tr>
- <tr id="i22" class="altColor">
- <td class="colFirst"><code>int</code></td>
- <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#insertAt(int,boolean,java.lang.String)">insertAt</a></span>​(int lineNum,
- boolean modify,
- java.lang.String src)</code></th>
- <td class="colLast">
- <div class="block">Inserts bytecode at the specified line in the body.</div>
- </td>
- </tr>
- <tr id="i23" class="rowColor">
- <td class="colFirst"><code>int</code></td>
- <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#insertAt(int,java.lang.String)">insertAt</a></span>​(int lineNum,
- java.lang.String src)</code></th>
- <td class="colLast">
- <div class="block">Inserts bytecode at the specified line in the body.</div>
- </td>
- </tr>
- <tr id="i24" class="altColor">
- <td class="colFirst"><code>void</code></td>
- <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#insertBefore(java.lang.String)">insertBefore</a></span>​(java.lang.String src)</code></th>
- <td class="colLast">
- <div class="block">Inserts bytecode at the beginning of the body.</div>
- </td>
- </tr>
- <tr id="i25" class="rowColor">
- <td class="colFirst"><code>void</code></td>
- <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#insertParameter(javassist.CtClass)">insertParameter</a></span>​(<a href="CtClass.html" title="class in javassist">CtClass</a> type)</code></th>
- <td class="colLast">
- <div class="block">Inserts a new parameter, which becomes the first parameter.</div>
- </td>
- </tr>
- <tr id="i26" class="altColor">
- <td class="colFirst"><code>void</code></td>
- <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#instrument(javassist.CodeConverter)">instrument</a></span>​(<a href="CodeConverter.html" title="class in javassist">CodeConverter</a> converter)</code></th>
- <td class="colLast">
- <div class="block">Modifies the method/constructor body.</div>
- </td>
- </tr>
- <tr id="i27" class="rowColor">
- <td class="colFirst"><code>void</code></td>
- <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#instrument(javassist.expr.ExprEditor)">instrument</a></span>​(<a href="expr/ExprEditor.html" title="class in javassist.expr">ExprEditor</a> editor)</code></th>
- <td class="colLast">
- <div class="block">Modifies the method/constructor body.</div>
- </td>
- </tr>
- <tr id="i28" class="altColor">
- <td class="colFirst"><code>abstract boolean</code></td>
- <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isEmpty()">isEmpty</a></span>()</code></th>
- <td class="colLast">
- <div class="block">Returns true if the body is empty.</div>
- </td>
- </tr>
- <tr id="i29" class="rowColor">
- <td class="colFirst"><code>void</code></td>
- <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setAttribute(java.lang.String,byte%5B%5D)">setAttribute</a></span>​(java.lang.String name,
- byte[] data)</code></th>
- <td class="colLast">
- <div class="block">Adds an attribute.</div>
- </td>
- </tr>
- <tr id="i30" class="altColor">
- <td class="colFirst"><code>void</code></td>
- <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setBody(java.lang.String)">setBody</a></span>​(java.lang.String src)</code></th>
- <td class="colLast">
- <div class="block">Sets a method/constructor body.</div>
- </td>
- </tr>
- <tr id="i31" class="rowColor">
- <td class="colFirst"><code>void</code></td>
- <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setBody(java.lang.String,java.lang.String,java.lang.String)">setBody</a></span>​(java.lang.String src,
- java.lang.String delegateObj,
- java.lang.String delegateMethod)</code></th>
- <td class="colLast">
- <div class="block">Sets a method/constructor body.</div>
- </td>
- </tr>
- <tr id="i32" class="altColor">
- <td class="colFirst"><code>void</code></td>
- <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setExceptionTypes(javassist.CtClass%5B%5D)">setExceptionTypes</a></span>​(<a href="CtClass.html" title="class in javassist">CtClass</a>[] types)</code></th>
- <td class="colLast">
- <div class="block">Sets exceptions that this method/constructor may throw.</div>
- </td>
- </tr>
- <tr id="i33" class="rowColor">
- <td class="colFirst"><code>void</code></td>
- <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setGenericSignature(java.lang.String)">setGenericSignature</a></span>​(java.lang.String sig)</code></th>
- <td class="colLast">
- <div class="block">Set the generic signature of the method.</div>
- </td>
- </tr>
- <tr id="i34" class="altColor">
- <td class="colFirst"><code>void</code></td>
- <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setModifiers(int)">setModifiers</a></span>​(int mod)</code></th>
- <td class="colLast">
- <div class="block">Sets the encoded modifiers of the method/constructor.</div>
- </td>
- </tr>
- <tr id="i35" class="rowColor">
- <td class="colFirst"><code>void</code></td>
- <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#useCflow(java.lang.String)">useCflow</a></span>​(java.lang.String name)</code></th>
- <td class="colLast">
- <div class="block">Declares to use <code>$cflow</code> for this method/constructor.</div>
- </td>
- </tr>
- </table>
- <ul class="blockList">
- <li class="blockList"><a id="methods.inherited.from.class.javassist.CtMember">
- <!-- -->
- </a>
- <h3>Methods inherited from class javassist.<a href="CtMember.html" title="class in javassist">CtMember</a></h3>
- <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>
- </ul>
- <ul class="blockList">
- <li class="blockList"><a id="methods.inherited.from.class.java.lang.Object">
- <!-- -->
- </a>
- <h3>Methods inherited from class java.lang.Object</h3>
- <code>equals, getClass, hashCode, notify, notifyAll, wait, wait, wait</code></li>
- </ul>
- </li>
- </ul>
- </section>
- </li>
- </ul>
- </div>
- <div class="details">
- <ul class="blockList">
- <li class="blockList">
- <!-- ============ METHOD DETAIL ========== -->
- <section role="region">
- <ul class="blockList">
- <li class="blockList"><a id="method.detail">
- <!-- -->
- </a>
- <h3>Method Detail</h3>
- <a id="getLongName()">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>getLongName</h4>
- <pre class="methodSignature">public abstract java.lang.String getLongName()</pre>
- <div class="block">Returns the method or constructor name followed by parameter types
- such as <code>javassist.CtBehavior.stBody(String)</code>.</div>
- <dl>
- <dt><span class="simpleTagLabel">Since:</span></dt>
- <dd>3.5</dd>
- </dl>
- </li>
- </ul>
- <a id="getMethodInfo()">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>getMethodInfo</h4>
- <pre class="methodSignature">public <a href="bytecode/MethodInfo.html" title="class in javassist.bytecode">MethodInfo</a> getMethodInfo()</pre>
- <div class="block">Returns the <code>MethodInfo</code> representing this method/constructor in the
- class file.
-
- <p>If you modify the bytecode through the returned
- <code>MethodInfo</code> object, you might have to explicitly
- rebuild a stack map table. Javassist does not automatically
- rebuild it for avoiding unnecessary rebuilding.</div>
- <dl>
- <dt><span class="seeLabel">See Also:</span></dt>
- <dd><a href="bytecode/MethodInfo.html#rebuildStackMap(javassist.ClassPool)"><code>MethodInfo.rebuildStackMap(ClassPool)</code></a></dd>
- </dl>
- </li>
- </ul>
- <a id="getMethodInfo2()">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>getMethodInfo2</h4>
- <pre class="methodSignature">public <a href="bytecode/MethodInfo.html" title="class in javassist.bytecode">MethodInfo</a> getMethodInfo2()</pre>
- <div class="block">Returns the <code>MethodInfo</code> representing the method/constructor in the
- class file (read only).
- Normal applications do not need calling this method. Use
- <code>getMethodInfo()</code>.
-
- <p>The <code>MethodInfo</code> object obtained by this method
- is read only. Changes to this object might not be reflected
- on a class file generated by <code>toBytecode()</code>,
- <code>toClass()</code>, etc in <code>CtClass</code>.
-
- <p>This method is available even if the <code>CtClass</code>
- containing this method is frozen. However, if the class is
- frozen, the <code>MethodInfo</code> might be also pruned.</div>
- <dl>
- <dt><span class="seeLabel">See Also:</span></dt>
- <dd><a href="#getMethodInfo()"><code>getMethodInfo()</code></a>,
- <a href="CtClass.html#isFrozen()"><code>CtClass.isFrozen()</code></a>,
- <a href="CtClass.html#prune()"><code>CtClass.prune()</code></a></dd>
- </dl>
- </li>
- </ul>
- <a id="getModifiers()">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>getModifiers</h4>
- <pre class="methodSignature">public int getModifiers()</pre>
- <div class="block">Obtains the modifiers of the method/constructor.</div>
- <dl>
- <dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
- <dd><code><a href="CtMember.html#getModifiers()">getModifiers</a></code> in class <code><a href="CtMember.html" title="class in javassist">CtMember</a></code></dd>
- <dt><span class="returnLabel">Returns:</span></dt>
- <dd>modifiers encoded with
- <code>javassist.Modifier</code>.</dd>
- <dt><span class="seeLabel">See Also:</span></dt>
- <dd><a href="Modifier.html" title="class in javassist"><code>Modifier</code></a></dd>
- </dl>
- </li>
- </ul>
- <a id="setModifiers(int)">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>setModifiers</h4>
- <pre class="methodSignature">public void setModifiers​(int mod)</pre>
- <div class="block">Sets the encoded modifiers of the method/constructor.
-
- <p>Changing the modifiers may cause a problem.
- For example, if a non-static method is changed to static,
- the method will be rejected by the bytecode verifier.</div>
- <dl>
- <dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
- <dd><code><a href="CtMember.html#setModifiers(int)">setModifiers</a></code> in class <code><a href="CtMember.html" title="class in javassist">CtMember</a></code></dd>
- <dt><span class="seeLabel">See Also:</span></dt>
- <dd><a href="Modifier.html" title="class in javassist"><code>Modifier</code></a></dd>
- </dl>
- </li>
- </ul>
- <a id="hasAnnotation(java.lang.String)">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>hasAnnotation</h4>
- <pre class="methodSignature">public boolean hasAnnotation​(java.lang.String typeName)</pre>
- <div class="block">Returns true if the class has the specified annotation type.</div>
- <dl>
- <dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
- <dd><code><a href="CtMember.html#hasAnnotation(java.lang.String)">hasAnnotation</a></code> in class <code><a href="CtMember.html" title="class in javassist">CtMember</a></code></dd>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>typeName</code> - the name of annotation type.</dd>
- <dt><span class="returnLabel">Returns:</span></dt>
- <dd><code>true</code> if the annotation is found,
- otherwise <code>false</code>.</dd>
- <dt><span class="simpleTagLabel">Since:</span></dt>
- <dd>3.21</dd>
- </dl>
- </li>
- </ul>
- <a id="getAnnotation(java.lang.Class)">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>getAnnotation</h4>
- <pre class="methodSignature">public java.lang.Object getAnnotation​(java.lang.Class<?> clz)
- throws java.lang.ClassNotFoundException</pre>
- <div class="block">Returns the annotation if the class has the specified annotation class.
- For example, if an annotation <code>@Author</code> is associated
- with this method/constructor, an <code>Author</code> object is returned.
- The member values can be obtained by calling methods on
- the <code>Author</code> object.</div>
- <dl>
- <dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
- <dd><code><a href="CtMember.html#getAnnotation(java.lang.Class)">getAnnotation</a></code> in class <code><a href="CtMember.html" title="class in javassist">CtMember</a></code></dd>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>clz</code> - the annotation class.</dd>
- <dt><span class="returnLabel">Returns:</span></dt>
- <dd>the annotation if found, otherwise <code>null</code>.</dd>
- <dt><span class="throwsLabel">Throws:</span></dt>
- <dd><code>java.lang.ClassNotFoundException</code></dd>
- <dt><span class="simpleTagLabel">Since:</span></dt>
- <dd>3.11</dd>
- </dl>
- </li>
- </ul>
- <a id="getAnnotations()">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>getAnnotations</h4>
- <pre class="methodSignature">public java.lang.Object[] getAnnotations()
- throws java.lang.ClassNotFoundException</pre>
- <div class="block">Returns the annotations associated with this method or constructor.</div>
- <dl>
- <dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
- <dd><code><a href="CtMember.html#getAnnotations()">getAnnotations</a></code> in class <code><a href="CtMember.html" title="class in javassist">CtMember</a></code></dd>
- <dt><span class="returnLabel">Returns:</span></dt>
- <dd>an array of annotation-type objects.</dd>
- <dt><span class="throwsLabel">Throws:</span></dt>
- <dd><code>java.lang.ClassNotFoundException</code></dd>
- <dt><span class="simpleTagLabel">Since:</span></dt>
- <dd>3.1</dd>
- <dt><span class="seeLabel">See Also:</span></dt>
- <dd><a href="#getAvailableAnnotations()"><code>getAvailableAnnotations()</code></a></dd>
- </dl>
- </li>
- </ul>
- <a id="getAvailableAnnotations()">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>getAvailableAnnotations</h4>
- <pre class="methodSignature">public java.lang.Object[] getAvailableAnnotations()</pre>
- <div class="block">Returns the annotations associated with this method or constructor.
- If any annotations are not on the classpath, they are not included
- in the returned array.</div>
- <dl>
- <dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
- <dd><code><a href="CtMember.html#getAvailableAnnotations()">getAvailableAnnotations</a></code> in class <code><a href="CtMember.html" title="class in javassist">CtMember</a></code></dd>
- <dt><span class="returnLabel">Returns:</span></dt>
- <dd>an array of annotation-type objects.</dd>
- <dt><span class="simpleTagLabel">Since:</span></dt>
- <dd>3.3</dd>
- <dt><span class="seeLabel">See Also:</span></dt>
- <dd><a href="#getAnnotations()"><code>getAnnotations()</code></a></dd>
- </dl>
- </li>
- </ul>
- <a id="getParameterAnnotations()">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>getParameterAnnotations</h4>
- <pre class="methodSignature">public java.lang.Object[][] getParameterAnnotations()
- throws java.lang.ClassNotFoundException</pre>
- <div class="block">Returns the parameter annotations associated with this method or constructor.</div>
- <dl>
- <dt><span class="returnLabel">Returns:</span></dt>
- <dd>an array of annotation-type objects. The length of the returned array is
- equal to the number of the formal parameters. If each parameter has no
- annotation, the elements of the returned array are empty arrays.</dd>
- <dt><span class="throwsLabel">Throws:</span></dt>
- <dd><code>java.lang.ClassNotFoundException</code></dd>
- <dt><span class="simpleTagLabel">Since:</span></dt>
- <dd>3.1</dd>
- <dt><span class="seeLabel">See Also:</span></dt>
- <dd><a href="#getAvailableParameterAnnotations()"><code>getAvailableParameterAnnotations()</code></a>,
- <a href="#getAnnotations()"><code>getAnnotations()</code></a></dd>
- </dl>
- </li>
- </ul>
- <a id="getAvailableParameterAnnotations()">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>getAvailableParameterAnnotations</h4>
- <pre class="methodSignature">public java.lang.Object[][] getAvailableParameterAnnotations()</pre>
- <div class="block">Returns the parameter annotations associated with this method or constructor.
- If any annotations are not on the classpath, they are not included in the
- returned array.</div>
- <dl>
- <dt><span class="returnLabel">Returns:</span></dt>
- <dd>an array of annotation-type objects. The length of the returned array is
- equal to the number of the formal parameters. If each parameter has no
- annotation, the elements of the returned array are empty arrays.</dd>
- <dt><span class="simpleTagLabel">Since:</span></dt>
- <dd>3.3</dd>
- <dt><span class="seeLabel">See Also:</span></dt>
- <dd><a href="#getParameterAnnotations()"><code>getParameterAnnotations()</code></a>,
- <a href="#getAvailableAnnotations()"><code>getAvailableAnnotations()</code></a></dd>
- </dl>
- </li>
- </ul>
- <a id="getParameterTypes()">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>getParameterTypes</h4>
- <pre class="methodSignature">public <a href="CtClass.html" title="class in javassist">CtClass</a>[] getParameterTypes()
- throws <a href="NotFoundException.html" title="class in javassist">NotFoundException</a></pre>
- <div class="block">Obtains parameter types of this method/constructor.</div>
- <dl>
- <dt><span class="throwsLabel">Throws:</span></dt>
- <dd><code><a href="NotFoundException.html" title="class in javassist">NotFoundException</a></code></dd>
- </dl>
- </li>
- </ul>
- <a id="getSignature()">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>getSignature</h4>
- <pre class="methodSignature">public java.lang.String getSignature()</pre>
- <div class="block">Returns the method signature (the parameter types
- and the return type).
- The method signature is represented by a character string
- called method descriptor, which is defined in the JVM specification.
- If two methods/constructors have
- the same parameter types
- and the return type, <code>getSignature()</code> returns the
- same string (the return type of constructors is <code>void</code>).
-
- <p>Note that the returned string is not the type signature
- contained in the <code>SignatureAttirbute</code>. It is
- a descriptor.</div>
- <dl>
- <dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
- <dd><code><a href="CtMember.html#getSignature()">getSignature</a></code> in class <code><a href="CtMember.html" title="class in javassist">CtMember</a></code></dd>
- <dt><span class="seeLabel">See Also:</span></dt>
- <dd><a href="bytecode/Descriptor.html" title="class in javassist.bytecode"><code>Descriptor</code></a>,
- <a href="#getGenericSignature()"><code>getGenericSignature()</code></a></dd>
- </dl>
- </li>
- </ul>
- <a id="getGenericSignature()">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>getGenericSignature</h4>
- <pre class="methodSignature">public java.lang.String getGenericSignature()</pre>
- <div class="block">Returns the generic signature of the method.
- It represents parameter types including type variables.</div>
- <dl>
- <dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
- <dd><code><a href="CtMember.html#getGenericSignature()">getGenericSignature</a></code> in class <code><a href="CtMember.html" title="class in javassist">CtMember</a></code></dd>
- <dt><span class="simpleTagLabel">Since:</span></dt>
- <dd>3.17</dd>
- <dt><span class="seeLabel">See Also:</span></dt>
- <dd><a href="bytecode/SignatureAttribute.html#toMethodSignature(java.lang.String)"><code>SignatureAttribute.toMethodSignature(String)</code></a></dd>
- </dl>
- </li>
- </ul>
- <a id="setGenericSignature(java.lang.String)">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>setGenericSignature</h4>
- <pre class="methodSignature">public void setGenericSignature​(java.lang.String sig)</pre>
- <div class="block">Set the generic signature of the method.
- It represents parameter types including type variables.
- See <a href="CtClass.html#setGenericSignature(java.lang.String)"><code>CtClass.setGenericSignature(String)</code></a>
- for a code sample.</div>
- <dl>
- <dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
- <dd><code><a href="CtMember.html#setGenericSignature(java.lang.String)">setGenericSignature</a></code> in class <code><a href="CtMember.html" title="class in javassist">CtMember</a></code></dd>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>sig</code> - a new generic signature.</dd>
- <dt><span class="simpleTagLabel">Since:</span></dt>
- <dd>3.17</dd>
- <dt><span class="seeLabel">See Also:</span></dt>
- <dd><a href="bytecode/SignatureAttribute.MethodSignature.html#encode()"><code>SignatureAttribute.MethodSignature.encode()</code></a></dd>
- </dl>
- </li>
- </ul>
- <a id="getExceptionTypes()">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>getExceptionTypes</h4>
- <pre class="methodSignature">public <a href="CtClass.html" title="class in javassist">CtClass</a>[] getExceptionTypes()
- throws <a href="NotFoundException.html" title="class in javassist">NotFoundException</a></pre>
- <div class="block">Obtains exceptions that this method/constructor may throw.</div>
- <dl>
- <dt><span class="returnLabel">Returns:</span></dt>
- <dd>a zero-length array if there is no throws clause.</dd>
- <dt><span class="throwsLabel">Throws:</span></dt>
- <dd><code><a href="NotFoundException.html" title="class in javassist">NotFoundException</a></code></dd>
- </dl>
- </li>
- </ul>
- <a id="setExceptionTypes(javassist.CtClass[])">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>setExceptionTypes</h4>
- <pre class="methodSignature">public void setExceptionTypes​(<a href="CtClass.html" title="class in javassist">CtClass</a>[] types)
- throws <a href="NotFoundException.html" title="class in javassist">NotFoundException</a></pre>
- <div class="block">Sets exceptions that this method/constructor may throw.</div>
- <dl>
- <dt><span class="throwsLabel">Throws:</span></dt>
- <dd><code><a href="NotFoundException.html" title="class in javassist">NotFoundException</a></code></dd>
- </dl>
- </li>
- </ul>
- <a id="isEmpty()">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>isEmpty</h4>
- <pre class="methodSignature">public abstract boolean isEmpty()</pre>
- <div class="block">Returns true if the body is empty.</div>
- </li>
- </ul>
- <a id="setBody(java.lang.String)">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>setBody</h4>
- <pre class="methodSignature">public void setBody​(java.lang.String src)
- throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
- <div class="block">Sets a method/constructor body.</div>
- <dl>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>src</code> - the source code representing the body.
- It must be a single statement or block.
- If it is <code>null</code>, the substituted
- body does nothing except returning zero or null.</dd>
- <dt><span class="throwsLabel">Throws:</span></dt>
- <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
- </dl>
- </li>
- </ul>
- <a id="setBody(java.lang.String,java.lang.String,java.lang.String)">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>setBody</h4>
- <pre class="methodSignature">public void setBody​(java.lang.String src,
- java.lang.String delegateObj,
- java.lang.String delegateMethod)
- throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
- <div class="block">Sets a method/constructor body.</div>
- <dl>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>src</code> - the source code representing the body.
- It must be a single statement or block.
- If it is <code>null</code>, the substituted
- body does nothing except returning zero or null.</dd>
- <dd><code>delegateObj</code> - the source text specifying the object
- that is called on by <code>$proceed()</code>.</dd>
- <dd><code>delegateMethod</code> - the name of the method
- that is called by <code>$proceed()</code>.</dd>
- <dt><span class="throwsLabel">Throws:</span></dt>
- <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
- </dl>
- </li>
- </ul>
- <a id="getAttribute(java.lang.String)">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>getAttribute</h4>
- <pre class="methodSignature">public byte[] getAttribute​(java.lang.String name)</pre>
- <div class="block">Obtains an attribute with the given name.
- If that attribute is not found in the class file, this
- method returns null.
-
- <p>Note that an attribute is a data block specified by
- the class file format. It is not an annotation.
- See <a href="bytecode/AttributeInfo.html" title="class in javassist.bytecode"><code>AttributeInfo</code></a>.</div>
- <dl>
- <dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
- <dd><code><a href="CtMember.html#getAttribute(java.lang.String)">getAttribute</a></code> in class <code><a href="CtMember.html" title="class in javassist">CtMember</a></code></dd>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>name</code> - attribute name</dd>
- </dl>
- </li>
- </ul>
- <a id="setAttribute(java.lang.String,byte[])">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>setAttribute</h4>
- <pre class="methodSignature">public void setAttribute​(java.lang.String name,
- byte[] data)</pre>
- <div class="block">Adds an attribute. The attribute is saved in the class file.
-
- <p>Note that an attribute is a data block specified by
- the class file format. It is not an annotation.
- See <a href="bytecode/AttributeInfo.html" title="class in javassist.bytecode"><code>AttributeInfo</code></a>.</div>
- <dl>
- <dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
- <dd><code><a href="CtMember.html#setAttribute(java.lang.String,byte%5B%5D)">setAttribute</a></code> in class <code><a href="CtMember.html" title="class in javassist">CtMember</a></code></dd>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>name</code> - attribute name</dd>
- <dd><code>data</code> - attribute value</dd>
- </dl>
- </li>
- </ul>
- <a id="useCflow(java.lang.String)">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>useCflow</h4>
- <pre class="methodSignature">public void useCflow​(java.lang.String name)
- throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
- <div class="block">Declares to use <code>$cflow</code> for this method/constructor.
- If <code>$cflow</code> is used, the class files modified
- with Javassist requires a support class
- <code>javassist.runtime.Cflow</code> at runtime
- (other Javassist classes are not required at runtime).
-
- <p>Every <code>$cflow</code> variable is given a unique name.
- For example, if the given name is <code>"Point.paint"</code>,
- then the variable is indicated by <code>$cflow(Point.paint)</code>.</div>
- <dl>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>name</code> - <code>$cflow</code> name. It can include
- alphabets, numbers, <code>_</code>,
- <code>$</code>, and <code>.</code> (dot).</dd>
- <dt><span class="throwsLabel">Throws:</span></dt>
- <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
- <dt><span class="seeLabel">See Also:</span></dt>
- <dd><a href="runtime/Cflow.html" title="class in javassist.runtime"><code>Cflow</code></a></dd>
- </dl>
- </li>
- </ul>
- <a id="addLocalVariable(java.lang.String,javassist.CtClass)">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>addLocalVariable</h4>
- <pre class="methodSignature">public void addLocalVariable​(java.lang.String name,
- <a href="CtClass.html" title="class in javassist">CtClass</a> type)
- throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
- <div class="block">Declares a new local variable. The scope of this variable is the
- whole method body. The initial value of that variable is not set.
- The declared variable can be accessed in the code snippet inserted
- by <code>insertBefore()</code>, <code>insertAfter()</code>, etc.
-
- <p>If the second parameter <code>asFinally</code> to
- <code>insertAfter()</code> is true, the declared local variable
- is not visible from the code inserted by <code>insertAfter()</code>.</div>
- <dl>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>name</code> - the name of the variable</dd>
- <dd><code>type</code> - the type of the variable</dd>
- <dt><span class="throwsLabel">Throws:</span></dt>
- <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
- <dt><span class="seeLabel">See Also:</span></dt>
- <dd><a href="#insertBefore(java.lang.String)"><code>insertBefore(String)</code></a>,
- <a href="#insertAfter(java.lang.String)"><code>insertAfter(String)</code></a></dd>
- </dl>
- </li>
- </ul>
- <a id="insertParameter(javassist.CtClass)">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>insertParameter</h4>
- <pre class="methodSignature">public void insertParameter​(<a href="CtClass.html" title="class in javassist">CtClass</a> type)
- throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
- <div class="block">Inserts a new parameter, which becomes the first parameter.</div>
- <dl>
- <dt><span class="throwsLabel">Throws:</span></dt>
- <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
- </dl>
- </li>
- </ul>
- <a id="addParameter(javassist.CtClass)">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>addParameter</h4>
- <pre class="methodSignature">public void addParameter​(<a href="CtClass.html" title="class in javassist">CtClass</a> type)
- throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
- <div class="block">Appends a new parameter, which becomes the last parameter.</div>
- <dl>
- <dt><span class="throwsLabel">Throws:</span></dt>
- <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
- </dl>
- </li>
- </ul>
- <a id="instrument(javassist.CodeConverter)">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>instrument</h4>
- <pre class="methodSignature">public void instrument​(<a href="CodeConverter.html" title="class in javassist">CodeConverter</a> converter)
- throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
- <div class="block">Modifies the method/constructor body.</div>
- <dl>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>converter</code> - specifies how to modify.</dd>
- <dt><span class="throwsLabel">Throws:</span></dt>
- <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
- </dl>
- </li>
- </ul>
- <a id="instrument(javassist.expr.ExprEditor)">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>instrument</h4>
- <pre class="methodSignature">public void instrument​(<a href="expr/ExprEditor.html" title="class in javassist.expr">ExprEditor</a> editor)
- throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
- <div class="block">Modifies the method/constructor body.
-
- <p>While executing this method, only <code>replace()</code>
- in <code>Expr</code> is available for bytecode modification.
- Other methods such as <code>insertBefore()</code> may collapse
- the bytecode because the <code>ExprEditor</code> loses
- its current position.</div>
- <dl>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>editor</code> - specifies how to modify.</dd>
- <dt><span class="throwsLabel">Throws:</span></dt>
- <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
- <dt><span class="seeLabel">See Also:</span></dt>
- <dd><a href="expr/Expr.html#replace(java.lang.String)"><code>Expr.replace(String)</code></a>,
- <a href="#insertBefore(java.lang.String)"><code>insertBefore(String)</code></a></dd>
- </dl>
- </li>
- </ul>
- <a id="insertBefore(java.lang.String)">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>insertBefore</h4>
- <pre class="methodSignature">public void insertBefore​(java.lang.String src)
- throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
- <div class="block">Inserts bytecode at the beginning of the body.
-
- <p>If this object represents a constructor,
- the bytecode is inserted before
- a constructor in the super class or this class is called.
- Therefore, the inserted bytecode is subject to constraints described
- in Section 4.8.2 of The Java Virtual Machine Specification (2nd ed).
- For example, it cannot access instance fields or methods although
- it may assign a value to an instance field directly declared in this
- class. Accessing static fields and methods is allowed.
- Use <code>insertBeforeBody()</code> in <code>CtConstructor</code>.</div>
- <dl>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>src</code> - the source code representing the inserted bytecode.
- It must be a single statement or block.</dd>
- <dt><span class="throwsLabel">Throws:</span></dt>
- <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
- <dt><span class="seeLabel">See Also:</span></dt>
- <dd><a href="CtConstructor.html#insertBeforeBody(java.lang.String)"><code>CtConstructor.insertBeforeBody(String)</code></a></dd>
- </dl>
- </li>
- </ul>
- <a id="insertAfter(java.lang.String)">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>insertAfter</h4>
- <pre class="methodSignature">public void insertAfter​(java.lang.String src)
- throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
- <div class="block">Inserts bytecode at the end of the body.
- The bytecode is inserted just before every return instruction.
- It is not executed when an exception is thrown.</div>
- <dl>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>src</code> - the source code representing the inserted bytecode.
- It must be a single statement or block.</dd>
- <dt><span class="throwsLabel">Throws:</span></dt>
- <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
- </dl>
- </li>
- </ul>
- <a id="insertAfter(java.lang.String,boolean)">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>insertAfter</h4>
- <pre class="methodSignature">public void insertAfter​(java.lang.String src,
- boolean asFinally)
- throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
- <div class="block">Inserts bytecode at the end of the body.
- The bytecode is inserted just before every return instruction.</div>
- <dl>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>src</code> - the source code representing the inserted bytecode.
- It must be a single statement or block.</dd>
- <dd><code>asFinally</code> - true if the inserted bytecode is executed
- not only when the control normally returns
- but also when an exception is thrown.
- If this parameter is true, the inserted code cannot
- access local variables.</dd>
- <dt><span class="throwsLabel">Throws:</span></dt>
- <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
- </dl>
- </li>
- </ul>
- <a id="insertAfter(java.lang.String,boolean,boolean)">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>insertAfter</h4>
- <pre class="methodSignature">public void insertAfter​(java.lang.String src,
- boolean asFinally,
- boolean redundant)
- throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
- <div class="block">Inserts bytecode at the end of the body.
- The bytecode is inserted just before every return instruction.</div>
- <dl>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>src</code> - the source code representing the inserted bytecode.
- It must be a single statement or block.</dd>
- <dd><code>asFinally</code> - true if the inserted bytecode is executed
- not only when the control normally returns
- but also when an exception is thrown.
- If this parameter is true, the inserted code cannot
- access local variables.</dd>
- <dd><code>redundant</code> - if true, redundant bytecode will be generated.
- the redundancy is necessary when some compilers (Kotlin?)
- generate the original bytecode.
- The other <code>insertAfter</code> methods calls this method
- with <code>false</code> for this parameter.
- A tip is to pass <code>this.getDeclaringClass().isKotlin()</code>
- to this parameter.</dd>
- <dt><span class="throwsLabel">Throws:</span></dt>
- <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
- <dt><span class="simpleTagLabel">Since:</span></dt>
- <dd>3.26</dd>
- <dt><span class="seeLabel">See Also:</span></dt>
- <dd><a href="CtClass.html#isKotlin()"><code>CtClass.isKotlin()</code></a>,
- <a href="CtMember.html#getDeclaringClass()"><code>CtMember.getDeclaringClass()</code></a></dd>
- </dl>
- </li>
- </ul>
- <a id="addCatch(java.lang.String,javassist.CtClass)">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>addCatch</h4>
- <pre class="methodSignature">public void addCatch​(java.lang.String src,
- <a href="CtClass.html" title="class in javassist">CtClass</a> exceptionType)
- throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
- <div class="block">Adds a catch clause that handles an exception thrown in the
- body. The catch clause must end with a return or throw statement.</div>
- <dl>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>src</code> - the source code representing the catch clause.
- It must be a single statement or block.</dd>
- <dd><code>exceptionType</code> - the type of the exception handled by the
- catch clause.</dd>
- <dt><span class="throwsLabel">Throws:</span></dt>
- <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
- </dl>
- </li>
- </ul>
- <a id="addCatch(java.lang.String,javassist.CtClass,java.lang.String)">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>addCatch</h4>
- <pre class="methodSignature">public void addCatch​(java.lang.String src,
- <a href="CtClass.html" title="class in javassist">CtClass</a> exceptionType,
- java.lang.String exceptionName)
- throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
- <div class="block">Adds a catch clause that handles an exception thrown in the
- body. The catch clause must end with a return or throw statement.</div>
- <dl>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>src</code> - the source code representing the catch clause.
- It must be a single statement or block.</dd>
- <dd><code>exceptionType</code> - the type of the exception handled by the
- catch clause.</dd>
- <dd><code>exceptionName</code> - the name of the variable containing the
- caught exception, for example,
- <code>$e</code>.</dd>
- <dt><span class="throwsLabel">Throws:</span></dt>
- <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
- </dl>
- </li>
- </ul>
- <a id="insertAt(int,java.lang.String)">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>insertAt</h4>
- <pre class="methodSignature">public int insertAt​(int lineNum,
- java.lang.String src)
- throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
- <div class="block">Inserts bytecode at the specified line in the body.
- It is equivalent to:
-
- <br><code>insertAt(lineNum, true, src)</code>
-
- <br>See this method as well.</div>
- <dl>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>lineNum</code> - the line number. The bytecode is inserted at the
- beginning of the code at the line specified by this
- line number.</dd>
- <dd><code>src</code> - the source code representing the inserted bytecode.
- It must be a single statement or block.</dd>
- <dt><span class="returnLabel">Returns:</span></dt>
- <dd>the line number at which the bytecode has been inserted.</dd>
- <dt><span class="throwsLabel">Throws:</span></dt>
- <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
- <dt><span class="seeLabel">See Also:</span></dt>
- <dd><a href="#insertAt(int,boolean,java.lang.String)"><code>insertAt(int,boolean,String)</code></a></dd>
- </dl>
- </li>
- </ul>
- <a id="insertAt(int,boolean,java.lang.String)">
- <!-- -->
- </a>
- <ul class="blockListLast">
- <li class="blockList">
- <h4>insertAt</h4>
- <pre class="methodSignature">public int insertAt​(int lineNum,
- boolean modify,
- java.lang.String src)
- throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
- <div class="block">Inserts bytecode at the specified line in the body.
-
- <p>If there is not
- a statement at the specified line, the bytecode might be inserted
- at the line including the first statement after that line specified.
- For example, if there is only a closing brace at that line, the
- bytecode would be inserted at another line below.
- To know exactly where the bytecode will be inserted, call with
- <code>modify</code> set to <code>false</code>.</div>
- <dl>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>lineNum</code> - the line number. The bytecode is inserted at the
- beginning of the code at the line specified by this
- line number.</dd>
- <dd><code>modify</code> - if false, this method does not insert the bytecode.
- It instead only returns the line number at which
- the bytecode would be inserted.</dd>
- <dd><code>src</code> - the source code representing the inserted bytecode.
- It must be a single statement or block.
- If modify is false, the value of src can be null.</dd>
- <dt><span class="returnLabel">Returns:</span></dt>
- <dd>the line number at which the bytecode has been inserted.</dd>
- <dt><span class="throwsLabel">Throws:</span></dt>
- <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
- </dl>
- </li>
- </ul>
- </li>
- </ul>
- </section>
- </li>
- </ul>
- </div>
- </div>
- </main>
- <!-- ========= END OF CLASS DATA ========= -->
- <footer role="contentinfo">
- <nav role="navigation">
- <!-- ======= START OF BOTTOM NAVBAR ====== -->
- <div class="bottomNav"><a id="navbar.bottom">
- <!-- -->
- </a>
- <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
- <a id="navbar.bottom.firstrow">
- <!-- -->
- </a>
- <ul class="navList" title="Navigation">
- <li><a href="../index.html">Overview</a></li>
- <li><a href="package-summary.html">Package</a></li>
- <li class="navBarCell1Rev">Class</li>
- <li><a href="class-use/CtBehavior.html">Use</a></li>
- <li><a href="package-tree.html">Tree</a></li>
- <li><a href="../deprecated-list.html">Deprecated</a></li>
- <li><a href="../index-all.html">Index</a></li>
- </ul>
- </div>
- <div class="subNav">
- <ul class="navList" id="allclasses_navbar_bottom">
- <li><a href="../allclasses.html">All Classes</a></li>
- </ul>
- <div>
- <script type="text/javascript"><!--
- allClassesLink = document.getElementById("allclasses_navbar_bottom");
- if(window==top) {
- allClassesLink.style.display = "block";
- }
- else {
- allClassesLink.style.display = "none";
- }
- //-->
- </script>
- <noscript>
- <div>JavaScript is disabled on your browser.</div>
- </noscript>
- </div>
- <div>
- <ul class="subNavList">
- <li>Summary: </li>
- <li>Nested | </li>
- <li>Field | </li>
- <li>Constr | </li>
- <li><a href="#method.summary">Method</a></li>
- </ul>
- <ul class="subNavList">
- <li>Detail: </li>
- <li>Field | </li>
- <li>Constr | </li>
- <li><a href="#method.detail">Method</a></li>
- </ul>
- </div>
- <a id="skip.navbar.bottom">
- <!-- -->
- </a></div>
- <!-- ======== END OF BOTTOM NAVBAR ======= -->
- </nav>
- <p class="legalCopy"><small><i>Javassist, a Java-bytecode translator toolkit.<br>
- Copyright (C) 1999- Shigeru Chiba. All Rights Reserved.</i></small></p>
- </footer>
- </body>
- </html>
|