blob: 6651605c6c873de518c82fd28ce5ef5d2a0ea479 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<meta name="copyright" content="Copyright (c) IBM Corporation and others 2000, 2005. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta name="GENERATOR" content="Mozilla/4.75 [en] (Windows NT 5.0; U) [Netscape]">
<title>
Generating getters and setters
</title>
<link rel="stylesheet" href="../book.css" charset="ISO-8859-1" type="text/css">
</head>
<body>
<h1>
Generating getters and setters
</h1>
<p>
The Java editor allows you to generate accessors (&quot;getters and setters&quot;) for the fields of a type inside a compilation unit.
</p>
<ol>
<li>
In the editor, select the field for which you want to generate accessors (or a type in which you want to create these methods).
</li>
<li>
Select <strong>Generate Getter and Setter</strong> from the <strong>Source</strong> pop-up menu.
</li>
<li>
A dialog will open to let you select which methods you want to create.
</li>
<li>
Select the methods and press OK.
</li>
</ol>
<p>
<img src="../images/ngrelc.png" alt="Related concepts" border="0" >
</p>
<p>
<a href="../concepts/concepts-7.htm">Java editor</a><br>
<a href="../concepts/concepts-3.htm">Java projects</a>
</p>
<p>
<img src="../images/ngrelt.png" alt="Related tasks" border="0" >
</p>
<p>
<a href="tasks-54.htm">Using the Java editor</a><br>
<a href="tasks-20.htm">Creating a class in an existing compilation unit</a>
</p>
<p>
<img src="../images/ngrelr.png" alt="Related reference" border="0" >
</p>
<p>
<a href="../reference/ref-dialog-gettersetter.htm">Generate Getter and Setter</a><br>
<a href="../reference/ref-view-outline.htm">Java outline</a>
</p>
</body>
</html>