123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970 |
- <!DOCTYPE HTML>
- <!-- NewPage -->
- <html lang="en">
- <head>
- <!-- Generated by javadoc (11) on Sat May 08 11:16:00 JST 2021 -->
- <title>CtField (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="CtField (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":10,"i12":10,"i13":10,"i14":9,"i15":10,"i16":10,"i17":10,"i18":10,"i19":10,"i20":10};
- var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance 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/CtField.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><a href="#nested.class.summary">Nested</a> | </li>
- <li>Field | </li>
- <li><a href="#constructor.summary">Constr</a> | </li>
- <li><a href="#method.summary">Method</a></li>
- </ul>
- <ul class="subNavList">
- <li>Detail: </li>
- <li>Field | </li>
- <li><a href="#constructor.detail">Constr</a> | </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 CtField" class="title">Class CtField</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.CtField</li>
- </ul>
- </li>
- </ul>
- </li>
- </ul>
- <div class="description">
- <ul class="blockList">
- <li class="blockList">
- <hr>
- <pre>public class <span class="typeNameLabel">CtField</span>
- extends <a href="CtMember.html" title="class in javassist">CtMember</a></pre>
- <div class="block">An instance of CtField represents a field.</div>
- <dl>
- <dt><span class="seeLabel">See Also:</span></dt>
- <dd><a href="CtClass.html#getDeclaredFields()"><code>CtClass.getDeclaredFields()</code></a></dd>
- </dl>
- </li>
- </ul>
- </div>
- <div class="summary">
- <ul class="blockList">
- <li class="blockList">
- <!-- ======== NESTED CLASS SUMMARY ======== -->
- <section role="region">
- <ul class="blockList">
- <li class="blockList"><a id="nested.class.summary">
- <!-- -->
- </a>
- <h3>Nested Class Summary</h3>
- <table class="memberSummary">
- <caption><span>Nested Classes</span><span class="tabEnd"> </span></caption>
- <tr>
- <th class="colFirst" scope="col">Modifier and Type</th>
- <th class="colSecond" scope="col">Class</th>
- <th class="colLast" scope="col">Description</th>
- </tr>
- <tr class="altColor">
- <td class="colFirst"><code>static class </code></td>
- <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="CtField.Initializer.html" title="class in javassist">CtField.Initializer</a></span></code></th>
- <td class="colLast">
- <div class="block">Instances of this class specify how to initialize a field.</div>
- </td>
- </tr>
- </table>
- </li>
- </ul>
- </section>
- <!-- ======== CONSTRUCTOR SUMMARY ======== -->
- <section role="region">
- <ul class="blockList">
- <li class="blockList"><a id="constructor.summary">
- <!-- -->
- </a>
- <h3>Constructor Summary</h3>
- <table class="memberSummary">
- <caption><span>Constructors</span><span class="tabEnd"> </span></caption>
- <tr>
- <th class="colFirst" scope="col">Constructor</th>
- <th class="colLast" scope="col">Description</th>
- </tr>
- <tr class="altColor">
- <th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E(javassist.CtClass,java.lang.String,javassist.CtClass)">CtField</a></span>​(<a href="CtClass.html" title="class in javassist">CtClass</a> type,
- java.lang.String name,
- <a href="CtClass.html" title="class in javassist">CtClass</a> declaring)</code></th>
- <td class="colLast">
- <div class="block">Creates a <code>CtField</code> object.</div>
- </td>
- </tr>
- <tr class="rowColor">
- <th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E(javassist.CtField,javassist.CtClass)">CtField</a></span>​(<a href="CtField.html" title="class in javassist">CtField</a> src,
- <a href="CtClass.html" title="class in javassist">CtClass</a> declaring)</code></th>
- <td class="colLast">
- <div class="block">Creates a copy of the given field.</div>
- </td>
- </tr>
- </table>
- </li>
- </ul>
- </section>
- <!-- ========== 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="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></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="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>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="i1" 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 field.</div>
- </td>
- </tr>
- <tr id="i2" 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="i3" 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 field.</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="#getConstantValue()">getConstantValue</a></span>()</code></th>
- <td class="colLast">
- <div class="block">Returns the value of this field if it is a constant field.</div>
- </td>
- </tr>
- <tr id="i5" 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="#getDeclaringClass()">getDeclaringClass</a></span>()</code></th>
- <td class="colLast">
- <div class="block">Returns the class declaring the field.</div>
- </td>
- </tr>
- <tr id="i6" class="altColor">
- <td class="colFirst"><code><a href="bytecode/FieldInfo.html" title="class in javassist.bytecode">FieldInfo</a></code></td>
- <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getFieldInfo()">getFieldInfo</a></span>()</code></th>
- <td class="colLast">
- <div class="block">Returns the FieldInfo representing the field in the class file.</div>
- </td>
- </tr>
- <tr id="i7" class="rowColor">
- <td class="colFirst"><code><a href="bytecode/FieldInfo.html" title="class in javassist.bytecode">FieldInfo</a></code></td>
- <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getFieldInfo2()">getFieldInfo2</a></span>()</code></th>
- <td class="colLast">
- <div class="block">Returns the FieldInfo representing the field in the class
- file (read only).</div>
- </td>
- </tr>
- <tr id="i8" 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 field.</div>
- </td>
- </tr>
- <tr id="i9" class="rowColor">
- <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">Returns the encoded modifiers of the field.</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="#getName()">getName</a></span>()</code></th>
- <td class="colLast">
- <div class="block">Returns the name of the field.</div>
- </td>
- </tr>
- <tr id="i11" 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 character string representing the type of the field.</div>
- </td>
- </tr>
- <tr id="i12" 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="#getType()">getType</a></span>()</code></th>
- <td class="colLast">
- <div class="block">Returns the type of the field.</div>
- </td>
- </tr>
- <tr id="i13" class="rowColor">
- <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="i14" class="altColor">
- <td class="colFirst"><code>static <a href="CtField.html" title="class in javassist">CtField</a></code></td>
- <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#make(java.lang.String,javassist.CtClass)">make</a></span>​(java.lang.String src,
- <a href="CtClass.html" title="class in javassist">CtClass</a> declaring)</code></th>
- <td class="colLast">
- <div class="block">Compiles the given source code and creates a field.</div>
- </td>
- </tr>
- <tr id="i15" 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="i16" class="altColor">
- <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 field.</div>
- </td>
- </tr>
- <tr id="i17" class="rowColor">
- <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 field.</div>
- </td>
- </tr>
- <tr id="i18" class="altColor">
- <td class="colFirst"><code>void</code></td>
- <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setName(java.lang.String)">setName</a></span>​(java.lang.String newName)</code></th>
- <td class="colLast">
- <div class="block">Changes the name of the field.</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="#setType(javassist.CtClass)">setType</a></span>​(<a href="CtClass.html" title="class in javassist">CtClass</a> clazz)</code></th>
- <td class="colLast">
- <div class="block">Sets the type of the field.</div>
- </td>
- </tr>
- <tr id="i20" class="altColor">
- <td class="colFirst"><code>java.lang.String</code></td>
- <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toString()">toString</a></span>()</code></th>
- <td class="colLast">
- <div class="block">Returns a String representation of the object.</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#hasAnnotation(java.lang.Class)">hasAnnotation</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">
- <!-- ========= CONSTRUCTOR DETAIL ======== -->
- <section role="region">
- <ul class="blockList">
- <li class="blockList"><a id="constructor.detail">
- <!-- -->
- </a>
- <h3>Constructor Detail</h3>
- <a id="<init>(javassist.CtClass,java.lang.String,javassist.CtClass)">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>CtField</h4>
- <pre>public CtField​(<a href="CtClass.html" title="class in javassist">CtClass</a> type,
- java.lang.String name,
- <a href="CtClass.html" title="class in javassist">CtClass</a> declaring)
- throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
- <div class="block">Creates a <code>CtField</code> object.
- The created field must be added to a class
- with <code>CtClass.addField()</code>.
- An initial value of the field is specified
- by a <code>CtField.Initializer</code> object.
-
- <p>If getter and setter methods are needed,
- call <code>CtNewMethod.getter()</code> and
- <code>CtNewMethod.setter()</code>.</div>
- <dl>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>type</code> - field type</dd>
- <dd><code>name</code> - field name</dd>
- <dd><code>declaring</code> - the class to which the field will be added.</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="CtClass.html#addField(javassist.CtField)"><code>CtClass.addField(CtField)</code></a>,
- <a href="CtNewMethod.html#getter(java.lang.String,javassist.CtField)"><code>CtNewMethod.getter(String,CtField)</code></a>,
- <a href="CtNewMethod.html#setter(java.lang.String,javassist.CtField)"><code>CtNewMethod.setter(String,CtField)</code></a>,
- <a href="CtField.Initializer.html" title="class in javassist"><code>CtField.Initializer</code></a></dd>
- </dl>
- </li>
- </ul>
- <a id="<init>(javassist.CtField,javassist.CtClass)">
- <!-- -->
- </a>
- <ul class="blockListLast">
- <li class="blockList">
- <h4>CtField</h4>
- <pre>public CtField​(<a href="CtField.html" title="class in javassist">CtField</a> src,
- <a href="CtClass.html" title="class in javassist">CtClass</a> declaring)
- throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
- <div class="block">Creates a copy of the given field.
- The created field must be added to a class
- with <code>CtClass.addField()</code>.
- An initial value of the field is specified
- by a <code>CtField.Initializer</code> object.
-
- <p>If getter and setter methods are needed,
- call <code>CtNewMethod.getter()</code> and
- <code>CtNewMethod.setter()</code>.</div>
- <dl>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>src</code> - the original field</dd>
- <dd><code>declaring</code> - the class to which the field will be added.</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="CtNewMethod.html#getter(java.lang.String,javassist.CtField)"><code>CtNewMethod.getter(String,CtField)</code></a>,
- <a href="CtNewMethod.html#setter(java.lang.String,javassist.CtField)"><code>CtNewMethod.setter(String,CtField)</code></a>,
- <a href="CtField.Initializer.html" title="class in javassist"><code>CtField.Initializer</code></a></dd>
- </dl>
- </li>
- </ul>
- </li>
- </ul>
- </section>
- <!-- ============ METHOD DETAIL ========== -->
- <section role="region">
- <ul class="blockList">
- <li class="blockList"><a id="method.detail">
- <!-- -->
- </a>
- <h3>Method Detail</h3>
- <a id="toString()">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>toString</h4>
- <pre class="methodSignature">public java.lang.String toString()</pre>
- <div class="block">Returns a String representation of the object.</div>
- <dl>
- <dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
- <dd><code><a href="CtMember.html#toString()">toString</a></code> in class <code><a href="CtMember.html" title="class in javassist">CtMember</a></code></dd>
- </dl>
- </li>
- </ul>
- <a id="make(java.lang.String,javassist.CtClass)">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>make</h4>
- <pre class="methodSignature">public static <a href="CtField.html" title="class in javassist">CtField</a> make​(java.lang.String src,
- <a href="CtClass.html" title="class in javassist">CtClass</a> declaring)
- throws <a href="CannotCompileException.html" title="class in javassist">CannotCompileException</a></pre>
- <div class="block">Compiles the given source code and creates a field.
- Examples of the source code are:
-
- <pre>
- "public String name;"
- "public int k = 3;"</pre>
-
- <p>Note that the source code ends with <code>';'</code>
- (semicolon).</div>
- <dl>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>src</code> - the source text.</dd>
- <dd><code>declaring</code> - the class to which the created field is added.</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="getFieldInfo()">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>getFieldInfo</h4>
- <pre class="methodSignature">public <a href="bytecode/FieldInfo.html" title="class in javassist.bytecode">FieldInfo</a> getFieldInfo()</pre>
- <div class="block">Returns the FieldInfo representing the field in the class file.</div>
- </li>
- </ul>
- <a id="getFieldInfo2()">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>getFieldInfo2</h4>
- <pre class="methodSignature">public <a href="bytecode/FieldInfo.html" title="class in javassist.bytecode">FieldInfo</a> getFieldInfo2()</pre>
- <div class="block">Returns the FieldInfo representing the field in the class
- file (read only).
- Normal applications do not need calling this method. Use
- <code>getFieldInfo()</code>.
-
- <p>The <code>FieldInfo</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 field is frozen. However, if the class is
- frozen, the <code>FieldInfo</code> might be also pruned.</div>
- <dl>
- <dt><span class="seeLabel">See Also:</span></dt>
- <dd><a href="#getFieldInfo()"><code>getFieldInfo()</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="getDeclaringClass()">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>getDeclaringClass</h4>
- <pre class="methodSignature">public <a href="CtClass.html" title="class in javassist">CtClass</a> getDeclaringClass()</pre>
- <div class="block">Returns the class declaring the field.</div>
- <dl>
- <dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
- <dd><code><a href="CtMember.html#getDeclaringClass()">getDeclaringClass</a></code> in class <code><a href="CtMember.html" title="class in javassist">CtMember</a></code></dd>
- </dl>
- </li>
- </ul>
- <a id="getName()">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>getName</h4>
- <pre class="methodSignature">public java.lang.String getName()</pre>
- <div class="block">Returns the name of the field.</div>
- <dl>
- <dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
- <dd><code><a href="CtMember.html#getName()">getName</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="CtConstructor.html#getName()"><code>CtConstructor.getName()</code></a></dd>
- </dl>
- </li>
- </ul>
- <a id="setName(java.lang.String)">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>setName</h4>
- <pre class="methodSignature">public void setName​(java.lang.String newName)</pre>
- <div class="block">Changes the name of the field.</div>
- </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">Returns the encoded modifiers of the field.</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 field.</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 field, 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 field.</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 field.
- 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="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 character string representing the type of the field.
- The field signature is represented by a character string
- called a field descriptor, which is defined in the JVM specification.
- If two fields have the same type,
- <code>getSignature()</code> returns the same string.
-
- <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 field.
- It represents a type 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#toFieldSignature(java.lang.String)"><code>SignatureAttribute.toFieldSignature(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 field.
- It represents a type 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.ObjectType.html#encode()"><code>SignatureAttribute.ObjectType.encode()</code></a></dd>
- </dl>
- </li>
- </ul>
- <a id="getType()">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>getType</h4>
- <pre class="methodSignature">public <a href="CtClass.html" title="class in javassist">CtClass</a> getType()
- throws <a href="NotFoundException.html" title="class in javassist">NotFoundException</a></pre>
- <div class="block">Returns the type of the field.</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="setType(javassist.CtClass)">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>setType</h4>
- <pre class="methodSignature">public void setType​(<a href="CtClass.html" title="class in javassist">CtClass</a> clazz)</pre>
- <div class="block">Sets the type of the field.
-
- <p>This method does not automatically update method bodies that access
- this field. They have to be explicitly updated. For example,
- if some method contains an expression <code>t.value</code> and the type
- of the variable <code>t</code> is changed by <a href="#setType(javassist.CtClass)"><code>setType(CtClass)</code></a>
- from <code>int</code> to <code>double</code>, then <code>t.value</code> has to be modified
- as well since the bytecode of <code>t.value</code> contains the type information.
- </p></div>
- <dl>
- <dt><span class="seeLabel">See Also:</span></dt>
- <dd><a href="CodeConverter.html" title="class in javassist"><code>CodeConverter</code></a>,
- <a href="expr/ExprEditor.html" title="class in javassist.expr"><code>ExprEditor</code></a></dd>
- </dl>
- </li>
- </ul>
- <a id="getConstantValue()">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>getConstantValue</h4>
- <pre class="methodSignature">public java.lang.Object getConstantValue()</pre>
- <div class="block">Returns the value of this field if it is a constant field.
- This method works only if the field type is a primitive type
- or <code>String</code> type. Otherwise, it returns <code>null</code>.
- A constant field is <code>static</code> and <code>final</code>.</div>
- <dl>
- <dt><span class="returnLabel">Returns:</span></dt>
- <dd>a <code>Integer</code>, <code>Long</code>, <code>Float</code>,
- <code>Double</code>, <code>Boolean</code>,
- or <code>String</code> object
- representing the constant value.
- <code>null</code> if it is not a constant field
- or if the field type is not a primitive type
- or <code>String</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.
- 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="blockListLast">
- <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.
- 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>
- </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/CtField.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><a href="#nested.class.summary">Nested</a> | </li>
- <li>Field | </li>
- <li><a href="#constructor.summary">Constr</a> | </li>
- <li><a href="#method.summary">Method</a></li>
- </ul>
- <ul class="subNavList">
- <li>Detail: </li>
- <li>Field | </li>
- <li><a href="#constructor.detail">Constr</a> | </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>
|