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.

CtField.html 39KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970
  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>CtField (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="CtField (Javassist API)";
  26. }
  27. }
  28. catch(err) {
  29. }
  30. //-->
  31. var data = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10,"i14":9,"i15":10,"i16":10,"i17":10,"i18":10,"i19":10,"i20":10};
  32. var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance 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/CtField.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><a href="#nested.class.summary">Nested</a>&nbsp;|&nbsp;</li>
  93. <li>Field&nbsp;|&nbsp;</li>
  94. <li><a href="#constructor.summary">Constr</a>&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><a href="#constructor.detail">Constr</a>&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 CtField" class="title">Class CtField</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.CtField</li>
  131. </ul>
  132. </li>
  133. </ul>
  134. </li>
  135. </ul>
  136. <div class="description">
  137. <ul class="blockList">
  138. <li class="blockList">
  139. <hr>
  140. <pre>public class <span class="typeNameLabel">CtField</span>
  141. extends <a href="CtMember.html" title="class in javassist">CtMember</a></pre>
  142. <div class="block">An instance of CtField represents a field.</div>
  143. <dl>
  144. <dt><span class="seeLabel">See Also:</span></dt>
  145. <dd><a href="CtClass.html#getDeclaredFields()"><code>CtClass.getDeclaredFields()</code></a></dd>
  146. </dl>
  147. </li>
  148. </ul>
  149. </div>
  150. <div class="summary">
  151. <ul class="blockList">
  152. <li class="blockList">
  153. <!-- ======== NESTED CLASS SUMMARY ======== -->
  154. <section role="region">
  155. <ul class="blockList">
  156. <li class="blockList"><a id="nested.class.summary">
  157. <!-- -->
  158. </a>
  159. <h3>Nested Class Summary</h3>
  160. <table class="memberSummary">
  161. <caption><span>Nested Classes</span><span class="tabEnd">&nbsp;</span></caption>
  162. <tr>
  163. <th class="colFirst" scope="col">Modifier and Type</th>
  164. <th class="colSecond" scope="col">Class</th>
  165. <th class="colLast" scope="col">Description</th>
  166. </tr>
  167. <tr class="altColor">
  168. <td class="colFirst"><code>static class&nbsp;</code></td>
  169. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="CtField.Initializer.html" title="class in javassist">CtField.Initializer</a></span></code></th>
  170. <td class="colLast">
  171. <div class="block">Instances of this class specify how to initialize a field.</div>
  172. </td>
  173. </tr>
  174. </table>
  175. </li>
  176. </ul>
  177. </section>
  178. <!-- ======== CONSTRUCTOR SUMMARY ======== -->
  179. <section role="region">
  180. <ul class="blockList">
  181. <li class="blockList"><a id="constructor.summary">
  182. <!-- -->
  183. </a>
  184. <h3>Constructor Summary</h3>
  185. <table class="memberSummary">
  186. <caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
  187. <tr>
  188. <th class="colFirst" scope="col">Constructor</th>
  189. <th class="colLast" scope="col">Description</th>
  190. </tr>
  191. <tr class="altColor">
  192. <th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E(javassist.CtClass,java.lang.String,javassist.CtClass)">CtField</a></span>&#8203;(<a href="CtClass.html" title="class in javassist">CtClass</a>&nbsp;type,
  193. java.lang.String&nbsp;name,
  194. <a href="CtClass.html" title="class in javassist">CtClass</a>&nbsp;declaring)</code></th>
  195. <td class="colLast">
  196. <div class="block">Creates a <code>CtField</code> object.</div>
  197. </td>
  198. </tr>
  199. <tr class="rowColor">
  200. <th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E(javassist.CtField,javassist.CtClass)">CtField</a></span>&#8203;(<a href="CtField.html" title="class in javassist">CtField</a>&nbsp;src,
  201. <a href="CtClass.html" title="class in javassist">CtClass</a>&nbsp;declaring)</code></th>
  202. <td class="colLast">
  203. <div class="block">Creates a copy of the given field.</div>
  204. </td>
  205. </tr>
  206. </table>
  207. </li>
  208. </ul>
  209. </section>
  210. <!-- ========== METHOD SUMMARY =========== -->
  211. <section role="region">
  212. <ul class="blockList">
  213. <li class="blockList"><a id="method.summary">
  214. <!-- -->
  215. </a>
  216. <h3>Method Summary</h3>
  217. <table class="memberSummary">
  218. <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
  219. <tr>
  220. <th class="colFirst" scope="col">Modifier and Type</th>
  221. <th class="colSecond" scope="col">Method</th>
  222. <th class="colLast" scope="col">Description</th>
  223. </tr>
  224. <tr id="i0" class="altColor">
  225. <td class="colFirst"><code>java.lang.Object</code></td>
  226. <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>
  227. <td class="colLast">
  228. <div class="block">Returns the annotation if the class has the specified annotation class.</div>
  229. </td>
  230. </tr>
  231. <tr id="i1" class="rowColor">
  232. <td class="colFirst"><code>java.lang.Object[]</code></td>
  233. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getAnnotations()">getAnnotations</a></span>()</code></th>
  234. <td class="colLast">
  235. <div class="block">Returns the annotations associated with this field.</div>
  236. </td>
  237. </tr>
  238. <tr id="i2" class="altColor">
  239. <td class="colFirst"><code>byte[]</code></td>
  240. <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>
  241. <td class="colLast">
  242. <div class="block">Obtains an attribute with the given name.</div>
  243. </td>
  244. </tr>
  245. <tr id="i3" class="rowColor">
  246. <td class="colFirst"><code>java.lang.Object[]</code></td>
  247. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getAvailableAnnotations()">getAvailableAnnotations</a></span>()</code></th>
  248. <td class="colLast">
  249. <div class="block">Returns the annotations associated with this field.</div>
  250. </td>
  251. </tr>
  252. <tr id="i4" class="altColor">
  253. <td class="colFirst"><code>java.lang.Object</code></td>
  254. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getConstantValue()">getConstantValue</a></span>()</code></th>
  255. <td class="colLast">
  256. <div class="block">Returns the value of this field if it is a constant field.</div>
  257. </td>
  258. </tr>
  259. <tr id="i5" class="rowColor">
  260. <td class="colFirst"><code><a href="CtClass.html" title="class in javassist">CtClass</a></code></td>
  261. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getDeclaringClass()">getDeclaringClass</a></span>()</code></th>
  262. <td class="colLast">
  263. <div class="block">Returns the class declaring the field.</div>
  264. </td>
  265. </tr>
  266. <tr id="i6" class="altColor">
  267. <td class="colFirst"><code><a href="bytecode/FieldInfo.html" title="class in javassist.bytecode">FieldInfo</a></code></td>
  268. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getFieldInfo()">getFieldInfo</a></span>()</code></th>
  269. <td class="colLast">
  270. <div class="block">Returns the FieldInfo representing the field in the class file.</div>
  271. </td>
  272. </tr>
  273. <tr id="i7" class="rowColor">
  274. <td class="colFirst"><code><a href="bytecode/FieldInfo.html" title="class in javassist.bytecode">FieldInfo</a></code></td>
  275. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getFieldInfo2()">getFieldInfo2</a></span>()</code></th>
  276. <td class="colLast">
  277. <div class="block">Returns the FieldInfo representing the field in the class
  278. file (read only).</div>
  279. </td>
  280. </tr>
  281. <tr id="i8" class="altColor">
  282. <td class="colFirst"><code>java.lang.String</code></td>
  283. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getGenericSignature()">getGenericSignature</a></span>()</code></th>
  284. <td class="colLast">
  285. <div class="block">Returns the generic signature of the field.</div>
  286. </td>
  287. </tr>
  288. <tr id="i9" class="rowColor">
  289. <td class="colFirst"><code>int</code></td>
  290. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getModifiers()">getModifiers</a></span>()</code></th>
  291. <td class="colLast">
  292. <div class="block">Returns the encoded modifiers of the field.</div>
  293. </td>
  294. </tr>
  295. <tr id="i10" class="altColor">
  296. <td class="colFirst"><code>java.lang.String</code></td>
  297. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getName()">getName</a></span>()</code></th>
  298. <td class="colLast">
  299. <div class="block">Returns the name of the field.</div>
  300. </td>
  301. </tr>
  302. <tr id="i11" class="rowColor">
  303. <td class="colFirst"><code>java.lang.String</code></td>
  304. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getSignature()">getSignature</a></span>()</code></th>
  305. <td class="colLast">
  306. <div class="block">Returns the character string representing the type of the field.</div>
  307. </td>
  308. </tr>
  309. <tr id="i12" class="altColor">
  310. <td class="colFirst"><code><a href="CtClass.html" title="class in javassist">CtClass</a></code></td>
  311. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getType()">getType</a></span>()</code></th>
  312. <td class="colLast">
  313. <div class="block">Returns the type of the field.</div>
  314. </td>
  315. </tr>
  316. <tr id="i13" class="rowColor">
  317. <td class="colFirst"><code>boolean</code></td>
  318. <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>
  319. <td class="colLast">
  320. <div class="block">Returns true if the class has the specified annotation type.</div>
  321. </td>
  322. </tr>
  323. <tr id="i14" class="altColor">
  324. <td class="colFirst"><code>static <a href="CtField.html" title="class in javassist">CtField</a></code></td>
  325. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#make(java.lang.String,javassist.CtClass)">make</a></span>&#8203;(java.lang.String&nbsp;src,
  326. <a href="CtClass.html" title="class in javassist">CtClass</a>&nbsp;declaring)</code></th>
  327. <td class="colLast">
  328. <div class="block">Compiles the given source code and creates a field.</div>
  329. </td>
  330. </tr>
  331. <tr id="i15" class="rowColor">
  332. <td class="colFirst"><code>void</code></td>
  333. <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,
  334. byte[]&nbsp;data)</code></th>
  335. <td class="colLast">
  336. <div class="block">Adds an attribute.</div>
  337. </td>
  338. </tr>
  339. <tr id="i16" class="altColor">
  340. <td class="colFirst"><code>void</code></td>
  341. <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>
  342. <td class="colLast">
  343. <div class="block">Set the generic signature of the field.</div>
  344. </td>
  345. </tr>
  346. <tr id="i17" class="rowColor">
  347. <td class="colFirst"><code>void</code></td>
  348. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setModifiers(int)">setModifiers</a></span>&#8203;(int&nbsp;mod)</code></th>
  349. <td class="colLast">
  350. <div class="block">Sets the encoded modifiers of the field.</div>
  351. </td>
  352. </tr>
  353. <tr id="i18" class="altColor">
  354. <td class="colFirst"><code>void</code></td>
  355. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setName(java.lang.String)">setName</a></span>&#8203;(java.lang.String&nbsp;newName)</code></th>
  356. <td class="colLast">
  357. <div class="block">Changes the name of the field.</div>
  358. </td>
  359. </tr>
  360. <tr id="i19" class="rowColor">
  361. <td class="colFirst"><code>void</code></td>
  362. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setType(javassist.CtClass)">setType</a></span>&#8203;(<a href="CtClass.html" title="class in javassist">CtClass</a>&nbsp;clazz)</code></th>
  363. <td class="colLast">
  364. <div class="block">Sets the type of the field.</div>
  365. </td>
  366. </tr>
  367. <tr id="i20" class="altColor">
  368. <td class="colFirst"><code>java.lang.String</code></td>
  369. <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toString()">toString</a></span>()</code></th>
  370. <td class="colLast">
  371. <div class="block">Returns a String representation of the object.</div>
  372. </td>
  373. </tr>
  374. </table>
  375. <ul class="blockList">
  376. <li class="blockList"><a id="methods.inherited.from.class.javassist.CtMember">
  377. <!-- -->
  378. </a>
  379. <h3>Methods inherited from class&nbsp;javassist.<a href="CtMember.html" title="class in javassist">CtMember</a></h3>
  380. <code><a href="CtMember.html#hasAnnotation(java.lang.Class)">hasAnnotation</a>, <a href="CtMember.html#visibleFrom(javassist.CtClass)">visibleFrom</a></code></li>
  381. </ul>
  382. <ul class="blockList">
  383. <li class="blockList"><a id="methods.inherited.from.class.java.lang.Object">
  384. <!-- -->
  385. </a>
  386. <h3>Methods inherited from class&nbsp;java.lang.Object</h3>
  387. <code>equals, getClass, hashCode, notify, notifyAll, wait, wait, wait</code></li>
  388. </ul>
  389. </li>
  390. </ul>
  391. </section>
  392. </li>
  393. </ul>
  394. </div>
  395. <div class="details">
  396. <ul class="blockList">
  397. <li class="blockList">
  398. <!-- ========= CONSTRUCTOR DETAIL ======== -->
  399. <section role="region">
  400. <ul class="blockList">
  401. <li class="blockList"><a id="constructor.detail">
  402. <!-- -->
  403. </a>
  404. <h3>Constructor Detail</h3>
  405. <a id="&lt;init&gt;(javassist.CtClass,java.lang.String,javassist.CtClass)">
  406. <!-- -->
  407. </a>
  408. <ul class="blockList">
  409. <li class="blockList">
  410. <h4>CtField</h4>
  411. <pre>public&nbsp;CtField&#8203;(<a href="CtClass.html" title="class in javassist">CtClass</a>&nbsp;type,
  412. java.lang.String&nbsp;name,
  413. <a href="CtClass.html" title="class in javassist">CtClass</a>&nbsp;declaring)
  414. throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
  415. <div class="block">Creates a <code>CtField</code> object.
  416. The created field must be added to a class
  417. with <code>CtClass.addField()</code>.
  418. An initial value of the field is specified
  419. by a <code>CtField.Initializer</code> object.
  420. <p>If getter and setter methods are needed,
  421. call <code>CtNewMethod.getter()</code> and
  422. <code>CtNewMethod.setter()</code>.</div>
  423. <dl>
  424. <dt><span class="paramLabel">Parameters:</span></dt>
  425. <dd><code>type</code> - field type</dd>
  426. <dd><code>name</code> - field name</dd>
  427. <dd><code>declaring</code> - the class to which the field will be added.</dd>
  428. <dt><span class="throwsLabel">Throws:</span></dt>
  429. <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
  430. <dt><span class="seeLabel">See Also:</span></dt>
  431. <dd><a href="CtClass.html#addField(javassist.CtField)"><code>CtClass.addField(CtField)</code></a>,
  432. <a href="CtNewMethod.html#getter(java.lang.String,javassist.CtField)"><code>CtNewMethod.getter(String,CtField)</code></a>,
  433. <a href="CtNewMethod.html#setter(java.lang.String,javassist.CtField)"><code>CtNewMethod.setter(String,CtField)</code></a>,
  434. <a href="CtField.Initializer.html" title="class in javassist"><code>CtField.Initializer</code></a></dd>
  435. </dl>
  436. </li>
  437. </ul>
  438. <a id="&lt;init&gt;(javassist.CtField,javassist.CtClass)">
  439. <!-- -->
  440. </a>
  441. <ul class="blockListLast">
  442. <li class="blockList">
  443. <h4>CtField</h4>
  444. <pre>public&nbsp;CtField&#8203;(<a href="CtField.html" title="class in javassist">CtField</a>&nbsp;src,
  445. <a href="CtClass.html" title="class in javassist">CtClass</a>&nbsp;declaring)
  446. throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
  447. <div class="block">Creates a copy of the given field.
  448. The created field must be added to a class
  449. with <code>CtClass.addField()</code>.
  450. An initial value of the field is specified
  451. by a <code>CtField.Initializer</code> object.
  452. <p>If getter and setter methods are needed,
  453. call <code>CtNewMethod.getter()</code> and
  454. <code>CtNewMethod.setter()</code>.</div>
  455. <dl>
  456. <dt><span class="paramLabel">Parameters:</span></dt>
  457. <dd><code>src</code> - the original field</dd>
  458. <dd><code>declaring</code> - the class to which the field will be added.</dd>
  459. <dt><span class="throwsLabel">Throws:</span></dt>
  460. <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
  461. <dt><span class="seeLabel">See Also:</span></dt>
  462. <dd><a href="CtNewMethod.html#getter(java.lang.String,javassist.CtField)"><code>CtNewMethod.getter(String,CtField)</code></a>,
  463. <a href="CtNewMethod.html#setter(java.lang.String,javassist.CtField)"><code>CtNewMethod.setter(String,CtField)</code></a>,
  464. <a href="CtField.Initializer.html" title="class in javassist"><code>CtField.Initializer</code></a></dd>
  465. </dl>
  466. </li>
  467. </ul>
  468. </li>
  469. </ul>
  470. </section>
  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="toString()">
  479. <!-- -->
  480. </a>
  481. <ul class="blockList">
  482. <li class="blockList">
  483. <h4>toString</h4>
  484. <pre class="methodSignature">public&nbsp;java.lang.String&nbsp;toString()</pre>
  485. <div class="block">Returns a String representation of the object.</div>
  486. <dl>
  487. <dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
  488. <dd><code><a href="CtMember.html#toString()">toString</a></code>&nbsp;in class&nbsp;<code><a href="CtMember.html" title="class in javassist">CtMember</a></code></dd>
  489. </dl>
  490. </li>
  491. </ul>
  492. <a id="make(java.lang.String,javassist.CtClass)">
  493. <!-- -->
  494. </a>
  495. <ul class="blockList">
  496. <li class="blockList">
  497. <h4>make</h4>
  498. <pre class="methodSignature">public static&nbsp;<a href="CtField.html" title="class in javassist">CtField</a>&nbsp;make&#8203;(java.lang.String&nbsp;src,
  499. <a href="CtClass.html" title="class in javassist">CtClass</a>&nbsp;declaring)
  500. throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
  501. <div class="block">Compiles the given source code and creates a field.
  502. Examples of the source code are:
  503. <pre>
  504. "public String name;"
  505. "public int k = 3;"</pre>
  506. <p>Note that the source code ends with <code>';'</code>
  507. (semicolon).</div>
  508. <dl>
  509. <dt><span class="paramLabel">Parameters:</span></dt>
  510. <dd><code>src</code> - the source text.</dd>
  511. <dd><code>declaring</code> - the class to which the created field is added.</dd>
  512. <dt><span class="throwsLabel">Throws:</span></dt>
  513. <dd><code><a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></code></dd>
  514. </dl>
  515. </li>
  516. </ul>
  517. <a id="getFieldInfo()">
  518. <!-- -->
  519. </a>
  520. <ul class="blockList">
  521. <li class="blockList">
  522. <h4>getFieldInfo</h4>
  523. <pre class="methodSignature">public&nbsp;<a href="bytecode/FieldInfo.html" title="class in javassist.bytecode">FieldInfo</a>&nbsp;getFieldInfo()</pre>
  524. <div class="block">Returns the FieldInfo representing the field in the class file.</div>
  525. </li>
  526. </ul>
  527. <a id="getFieldInfo2()">
  528. <!-- -->
  529. </a>
  530. <ul class="blockList">
  531. <li class="blockList">
  532. <h4>getFieldInfo2</h4>
  533. <pre class="methodSignature">public&nbsp;<a href="bytecode/FieldInfo.html" title="class in javassist.bytecode">FieldInfo</a>&nbsp;getFieldInfo2()</pre>
  534. <div class="block">Returns the FieldInfo representing the field in the class
  535. file (read only).
  536. Normal applications do not need calling this method. Use
  537. <code>getFieldInfo()</code>.
  538. <p>The <code>FieldInfo</code> object obtained by this method
  539. is read only. Changes to this object might not be reflected
  540. on a class file generated by <code>toBytecode()</code>,
  541. <code>toClass()</code>, etc in <code>CtClass</code>.
  542. <p>This method is available even if the <code>CtClass</code>
  543. containing this field is frozen. However, if the class is
  544. frozen, the <code>FieldInfo</code> might be also pruned.</div>
  545. <dl>
  546. <dt><span class="seeLabel">See Also:</span></dt>
  547. <dd><a href="#getFieldInfo()"><code>getFieldInfo()</code></a>,
  548. <a href="CtClass.html#isFrozen()"><code>CtClass.isFrozen()</code></a>,
  549. <a href="CtClass.html#prune()"><code>CtClass.prune()</code></a></dd>
  550. </dl>
  551. </li>
  552. </ul>
  553. <a id="getDeclaringClass()">
  554. <!-- -->
  555. </a>
  556. <ul class="blockList">
  557. <li class="blockList">
  558. <h4>getDeclaringClass</h4>
  559. <pre class="methodSignature">public&nbsp;<a href="CtClass.html" title="class in javassist">CtClass</a>&nbsp;getDeclaringClass()</pre>
  560. <div class="block">Returns the class declaring the field.</div>
  561. <dl>
  562. <dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
  563. <dd><code><a href="CtMember.html#getDeclaringClass()">getDeclaringClass</a></code>&nbsp;in class&nbsp;<code><a href="CtMember.html" title="class in javassist">CtMember</a></code></dd>
  564. </dl>
  565. </li>
  566. </ul>
  567. <a id="getName()">
  568. <!-- -->
  569. </a>
  570. <ul class="blockList">
  571. <li class="blockList">
  572. <h4>getName</h4>
  573. <pre class="methodSignature">public&nbsp;java.lang.String&nbsp;getName()</pre>
  574. <div class="block">Returns the name of the field.</div>
  575. <dl>
  576. <dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
  577. <dd><code><a href="CtMember.html#getName()">getName</a></code>&nbsp;in class&nbsp;<code><a href="CtMember.html" title="class in javassist">CtMember</a></code></dd>
  578. <dt><span class="seeLabel">See Also:</span></dt>
  579. <dd><a href="CtConstructor.html#getName()"><code>CtConstructor.getName()</code></a></dd>
  580. </dl>
  581. </li>
  582. </ul>
  583. <a id="setName(java.lang.String)">
  584. <!-- -->
  585. </a>
  586. <ul class="blockList">
  587. <li class="blockList">
  588. <h4>setName</h4>
  589. <pre class="methodSignature">public&nbsp;void&nbsp;setName&#8203;(java.lang.String&nbsp;newName)</pre>
  590. <div class="block">Changes the name of the field.</div>
  591. </li>
  592. </ul>
  593. <a id="getModifiers()">
  594. <!-- -->
  595. </a>
  596. <ul class="blockList">
  597. <li class="blockList">
  598. <h4>getModifiers</h4>
  599. <pre class="methodSignature">public&nbsp;int&nbsp;getModifiers()</pre>
  600. <div class="block">Returns the encoded modifiers of the field.</div>
  601. <dl>
  602. <dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
  603. <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>
  604. <dt><span class="returnLabel">Returns:</span></dt>
  605. <dd>modifiers encoded with
  606. <code>javassist.Modifier</code>.</dd>
  607. <dt><span class="seeLabel">See Also:</span></dt>
  608. <dd><a href="Modifier.html" title="class in javassist"><code>Modifier</code></a></dd>
  609. </dl>
  610. </li>
  611. </ul>
  612. <a id="setModifiers(int)">
  613. <!-- -->
  614. </a>
  615. <ul class="blockList">
  616. <li class="blockList">
  617. <h4>setModifiers</h4>
  618. <pre class="methodSignature">public&nbsp;void&nbsp;setModifiers&#8203;(int&nbsp;mod)</pre>
  619. <div class="block">Sets the encoded modifiers of the field.</div>
  620. <dl>
  621. <dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
  622. <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>
  623. <dt><span class="seeLabel">See Also:</span></dt>
  624. <dd><a href="Modifier.html" title="class in javassist"><code>Modifier</code></a></dd>
  625. </dl>
  626. </li>
  627. </ul>
  628. <a id="hasAnnotation(java.lang.String)">
  629. <!-- -->
  630. </a>
  631. <ul class="blockList">
  632. <li class="blockList">
  633. <h4>hasAnnotation</h4>
  634. <pre class="methodSignature">public&nbsp;boolean&nbsp;hasAnnotation&#8203;(java.lang.String&nbsp;typeName)</pre>
  635. <div class="block">Returns true if the class has the specified annotation type.</div>
  636. <dl>
  637. <dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
  638. <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>
  639. <dt><span class="paramLabel">Parameters:</span></dt>
  640. <dd><code>typeName</code> - the name of annotation type.</dd>
  641. <dt><span class="returnLabel">Returns:</span></dt>
  642. <dd><code>true</code> if the annotation is found, otherwise <code>false</code>.</dd>
  643. <dt><span class="simpleTagLabel">Since:</span></dt>
  644. <dd>3.21</dd>
  645. </dl>
  646. </li>
  647. </ul>
  648. <a id="getAnnotation(java.lang.Class)">
  649. <!-- -->
  650. </a>
  651. <ul class="blockList">
  652. <li class="blockList">
  653. <h4>getAnnotation</h4>
  654. <pre class="methodSignature">public&nbsp;java.lang.Object&nbsp;getAnnotation&#8203;(java.lang.Class&lt;?&gt;&nbsp;clz)
  655. throws java.lang.ClassNotFoundException</pre>
  656. <div class="block">Returns the annotation if the class has the specified annotation class.
  657. For example, if an annotation <code>@Author</code> is associated
  658. with this field, an <code>Author</code> object is returned.
  659. The member values can be obtained by calling methods on
  660. the <code>Author</code> object.</div>
  661. <dl>
  662. <dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
  663. <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>
  664. <dt><span class="paramLabel">Parameters:</span></dt>
  665. <dd><code>clz</code> - the annotation class.</dd>
  666. <dt><span class="returnLabel">Returns:</span></dt>
  667. <dd>the annotation if found, otherwise <code>null</code>.</dd>
  668. <dt><span class="throwsLabel">Throws:</span></dt>
  669. <dd><code>java.lang.ClassNotFoundException</code></dd>
  670. <dt><span class="simpleTagLabel">Since:</span></dt>
  671. <dd>3.11</dd>
  672. </dl>
  673. </li>
  674. </ul>
  675. <a id="getAnnotations()">
  676. <!-- -->
  677. </a>
  678. <ul class="blockList">
  679. <li class="blockList">
  680. <h4>getAnnotations</h4>
  681. <pre class="methodSignature">public&nbsp;java.lang.Object[]&nbsp;getAnnotations()
  682. throws java.lang.ClassNotFoundException</pre>
  683. <div class="block">Returns the annotations associated with this field.</div>
  684. <dl>
  685. <dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
  686. <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>
  687. <dt><span class="returnLabel">Returns:</span></dt>
  688. <dd>an array of annotation-type objects.</dd>
  689. <dt><span class="throwsLabel">Throws:</span></dt>
  690. <dd><code>java.lang.ClassNotFoundException</code></dd>
  691. <dt><span class="simpleTagLabel">Since:</span></dt>
  692. <dd>3.1</dd>
  693. <dt><span class="seeLabel">See Also:</span></dt>
  694. <dd><a href="#getAvailableAnnotations()"><code>getAvailableAnnotations()</code></a></dd>
  695. </dl>
  696. </li>
  697. </ul>
  698. <a id="getAvailableAnnotations()">
  699. <!-- -->
  700. </a>
  701. <ul class="blockList">
  702. <li class="blockList">
  703. <h4>getAvailableAnnotations</h4>
  704. <pre class="methodSignature">public&nbsp;java.lang.Object[]&nbsp;getAvailableAnnotations()</pre>
  705. <div class="block">Returns the annotations associated with this field.
  706. If any annotations are not on the classpath, they are not included
  707. in the returned array.</div>
  708. <dl>
  709. <dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
  710. <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>
  711. <dt><span class="returnLabel">Returns:</span></dt>
  712. <dd>an array of annotation-type objects.</dd>
  713. <dt><span class="simpleTagLabel">Since:</span></dt>
  714. <dd>3.3</dd>
  715. <dt><span class="seeLabel">See Also:</span></dt>
  716. <dd><a href="#getAnnotations()"><code>getAnnotations()</code></a></dd>
  717. </dl>
  718. </li>
  719. </ul>
  720. <a id="getSignature()">
  721. <!-- -->
  722. </a>
  723. <ul class="blockList">
  724. <li class="blockList">
  725. <h4>getSignature</h4>
  726. <pre class="methodSignature">public&nbsp;java.lang.String&nbsp;getSignature()</pre>
  727. <div class="block">Returns the character string representing the type of the field.
  728. The field signature is represented by a character string
  729. called a field descriptor, which is defined in the JVM specification.
  730. If two fields have the same type,
  731. <code>getSignature()</code> returns the same string.
  732. <p>Note that the returned string is not the type signature
  733. contained in the <code>SignatureAttirbute</code>. It is
  734. a descriptor.</div>
  735. <dl>
  736. <dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
  737. <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>
  738. <dt><span class="seeLabel">See Also:</span></dt>
  739. <dd><a href="bytecode/Descriptor.html" title="class in javassist.bytecode"><code>Descriptor</code></a>,
  740. <a href="#getGenericSignature()"><code>getGenericSignature()</code></a></dd>
  741. </dl>
  742. </li>
  743. </ul>
  744. <a id="getGenericSignature()">
  745. <!-- -->
  746. </a>
  747. <ul class="blockList">
  748. <li class="blockList">
  749. <h4>getGenericSignature</h4>
  750. <pre class="methodSignature">public&nbsp;java.lang.String&nbsp;getGenericSignature()</pre>
  751. <div class="block">Returns the generic signature of the field.
  752. It represents a type including type variables.</div>
  753. <dl>
  754. <dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
  755. <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>
  756. <dt><span class="simpleTagLabel">Since:</span></dt>
  757. <dd>3.17</dd>
  758. <dt><span class="seeLabel">See Also:</span></dt>
  759. <dd><a href="bytecode/SignatureAttribute.html#toFieldSignature(java.lang.String)"><code>SignatureAttribute.toFieldSignature(String)</code></a></dd>
  760. </dl>
  761. </li>
  762. </ul>
  763. <a id="setGenericSignature(java.lang.String)">
  764. <!-- -->
  765. </a>
  766. <ul class="blockList">
  767. <li class="blockList">
  768. <h4>setGenericSignature</h4>
  769. <pre class="methodSignature">public&nbsp;void&nbsp;setGenericSignature&#8203;(java.lang.String&nbsp;sig)</pre>
  770. <div class="block">Set the generic signature of the field.
  771. It represents a type including type variables.
  772. See <a href="CtClass.html#setGenericSignature(java.lang.String)"><code>CtClass.setGenericSignature(String)</code></a>
  773. for a code sample.</div>
  774. <dl>
  775. <dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
  776. <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>
  777. <dt><span class="paramLabel">Parameters:</span></dt>
  778. <dd><code>sig</code> - a new generic signature.</dd>
  779. <dt><span class="simpleTagLabel">Since:</span></dt>
  780. <dd>3.17</dd>
  781. <dt><span class="seeLabel">See Also:</span></dt>
  782. <dd><a href="bytecode/SignatureAttribute.ObjectType.html#encode()"><code>SignatureAttribute.ObjectType.encode()</code></a></dd>
  783. </dl>
  784. </li>
  785. </ul>
  786. <a id="getType()">
  787. <!-- -->
  788. </a>
  789. <ul class="blockList">
  790. <li class="blockList">
  791. <h4>getType</h4>
  792. <pre class="methodSignature">public&nbsp;<a href="CtClass.html" title="class in javassist">CtClass</a>&nbsp;getType()
  793. throws <a href="NotFoundException.html" title="class in javassist">NotFoundException</a></pre>
  794. <div class="block">Returns the type of the field.</div>
  795. <dl>
  796. <dt><span class="throwsLabel">Throws:</span></dt>
  797. <dd><code><a href="NotFoundException.html" title="class in javassist">NotFoundException</a></code></dd>
  798. </dl>
  799. </li>
  800. </ul>
  801. <a id="setType(javassist.CtClass)">
  802. <!-- -->
  803. </a>
  804. <ul class="blockList">
  805. <li class="blockList">
  806. <h4>setType</h4>
  807. <pre class="methodSignature">public&nbsp;void&nbsp;setType&#8203;(<a href="CtClass.html" title="class in javassist">CtClass</a>&nbsp;clazz)</pre>
  808. <div class="block">Sets the type of the field.
  809. <p>This method does not automatically update method bodies that access
  810. this field. They have to be explicitly updated. For example,
  811. if some method contains an expression <code>t.value</code> and the type
  812. of the variable <code>t</code> is changed by <a href="#setType(javassist.CtClass)"><code>setType(CtClass)</code></a>
  813. from <code>int</code> to <code>double</code>, then <code>t.value</code> has to be modified
  814. as well since the bytecode of <code>t.value</code> contains the type information.
  815. </p></div>
  816. <dl>
  817. <dt><span class="seeLabel">See Also:</span></dt>
  818. <dd><a href="CodeConverter.html" title="class in javassist"><code>CodeConverter</code></a>,
  819. <a href="expr/ExprEditor.html" title="class in javassist.expr"><code>ExprEditor</code></a></dd>
  820. </dl>
  821. </li>
  822. </ul>
  823. <a id="getConstantValue()">
  824. <!-- -->
  825. </a>
  826. <ul class="blockList">
  827. <li class="blockList">
  828. <h4>getConstantValue</h4>
  829. <pre class="methodSignature">public&nbsp;java.lang.Object&nbsp;getConstantValue()</pre>
  830. <div class="block">Returns the value of this field if it is a constant field.
  831. This method works only if the field type is a primitive type
  832. or <code>String</code> type. Otherwise, it returns <code>null</code>.
  833. A constant field is <code>static</code> and <code>final</code>.</div>
  834. <dl>
  835. <dt><span class="returnLabel">Returns:</span></dt>
  836. <dd>a <code>Integer</code>, <code>Long</code>, <code>Float</code>,
  837. <code>Double</code>, <code>Boolean</code>,
  838. or <code>String</code> object
  839. representing the constant value.
  840. <code>null</code> if it is not a constant field
  841. or if the field type is not a primitive type
  842. or <code>String</code>.</dd>
  843. </dl>
  844. </li>
  845. </ul>
  846. <a id="getAttribute(java.lang.String)">
  847. <!-- -->
  848. </a>
  849. <ul class="blockList">
  850. <li class="blockList">
  851. <h4>getAttribute</h4>
  852. <pre class="methodSignature">public&nbsp;byte[]&nbsp;getAttribute&#8203;(java.lang.String&nbsp;name)</pre>
  853. <div class="block">Obtains an attribute with the given name.
  854. If that attribute is not found in the class file, this
  855. method returns null.
  856. <p>Note that an attribute is a data block specified by
  857. the class file format.
  858. See <a href="bytecode/AttributeInfo.html" title="class in javassist.bytecode"><code>AttributeInfo</code></a>.</div>
  859. <dl>
  860. <dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
  861. <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>
  862. <dt><span class="paramLabel">Parameters:</span></dt>
  863. <dd><code>name</code> - attribute name</dd>
  864. </dl>
  865. </li>
  866. </ul>
  867. <a id="setAttribute(java.lang.String,byte[])">
  868. <!-- -->
  869. </a>
  870. <ul class="blockListLast">
  871. <li class="blockList">
  872. <h4>setAttribute</h4>
  873. <pre class="methodSignature">public&nbsp;void&nbsp;setAttribute&#8203;(java.lang.String&nbsp;name,
  874. byte[]&nbsp;data)</pre>
  875. <div class="block">Adds an attribute. The attribute is saved in the class file.
  876. <p>Note that an attribute is a data block specified by
  877. the class file format.
  878. See <a href="bytecode/AttributeInfo.html" title="class in javassist.bytecode"><code>AttributeInfo</code></a>.</div>
  879. <dl>
  880. <dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
  881. <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>
  882. <dt><span class="paramLabel">Parameters:</span></dt>
  883. <dd><code>name</code> - attribute name</dd>
  884. <dd><code>data</code> - attribute value</dd>
  885. </dl>
  886. </li>
  887. </ul>
  888. </li>
  889. </ul>
  890. </section>
  891. </li>
  892. </ul>
  893. </div>
  894. </div>
  895. </main>
  896. <!-- ========= END OF CLASS DATA ========= -->
  897. <footer role="contentinfo">
  898. <nav role="navigation">
  899. <!-- ======= START OF BOTTOM NAVBAR ====== -->
  900. <div class="bottomNav"><a id="navbar.bottom">
  901. <!-- -->
  902. </a>
  903. <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
  904. <a id="navbar.bottom.firstrow">
  905. <!-- -->
  906. </a>
  907. <ul class="navList" title="Navigation">
  908. <li><a href="../index.html">Overview</a></li>
  909. <li><a href="package-summary.html">Package</a></li>
  910. <li class="navBarCell1Rev">Class</li>
  911. <li><a href="class-use/CtField.html">Use</a></li>
  912. <li><a href="package-tree.html">Tree</a></li>
  913. <li><a href="../deprecated-list.html">Deprecated</a></li>
  914. <li><a href="../index-all.html">Index</a></li>
  915. </ul>
  916. </div>
  917. <div class="subNav">
  918. <ul class="navList" id="allclasses_navbar_bottom">
  919. <li><a href="../allclasses.html">All&nbsp;Classes</a></li>
  920. </ul>
  921. <div>
  922. <script type="text/javascript"><!--
  923. allClassesLink = document.getElementById("allclasses_navbar_bottom");
  924. if(window==top) {
  925. allClassesLink.style.display = "block";
  926. }
  927. else {
  928. allClassesLink.style.display = "none";
  929. }
  930. //-->
  931. </script>
  932. <noscript>
  933. <div>JavaScript is disabled on your browser.</div>
  934. </noscript>
  935. </div>
  936. <div>
  937. <ul class="subNavList">
  938. <li>Summary:&nbsp;</li>
  939. <li><a href="#nested.class.summary">Nested</a>&nbsp;|&nbsp;</li>
  940. <li>Field&nbsp;|&nbsp;</li>
  941. <li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
  942. <li><a href="#method.summary">Method</a></li>
  943. </ul>
  944. <ul class="subNavList">
  945. <li>Detail:&nbsp;</li>
  946. <li>Field&nbsp;|&nbsp;</li>
  947. <li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
  948. <li><a href="#method.detail">Method</a></li>
  949. </ul>
  950. </div>
  951. <a id="skip.navbar.bottom">
  952. <!-- -->
  953. </a></div>
  954. <!-- ======== END OF BOTTOM NAVBAR ======= -->
  955. </nav>
  956. <p class="legalCopy"><small><i>Javassist, a Java-bytecode translator toolkit.<br>
  957. Copyright (C) 1999- Shigeru Chiba. All Rights Reserved.</i></small></p>
  958. </footer>
  959. </body>
  960. </html>