Auto Generating get and set methods.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Auto Generating get and set methods.

Zachary1234-2
-Is there an automatic way, or a working plugin way, to autogenerate
getter and setter methods for some nominated class variable?

-Where in the latest stable netbeans do I go to do this when programming?

setSomeMethodName(int input)
{
this.number = input;
}


getSomeMethodName()
{
return this.number;
}




Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Auto Generating get and set methods.

tkellerer

Zachary1234 wrote:

> -Is there an automatic way, or a working plugin way, to autogenerate
> getter and setter methods for some nominated class variable?
>
> -Where in the latest stable netbeans do I go to do this when programming?
>
> setSomeMethodName(int input)
> {
> this.number = input;
> }
>
> getSomeMethodName()
> {
> return this.number;
> }


From the main menu: "Refactor -> Generate Encapsulate Fields..." to do it for several instance variables in a single go. Or put the cursor on one variable, then use the Shortcut "Insert Code" (Alt-INSERT) and select "Getter and Setter" from the popup menu.




Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Auto Generating get and set methods.

Zachary1234-2
In reply to this post by Zachary1234-2
Thank you very much.  Netbeans can do this.




Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Auto Generating get and set methods.

Sean Carrick-4
In reply to this post by Zachary1234-2
Zachary,

In the IDE, you can do this three ways:

1. On the main menu bar, click on Source...Insert Code...

2. Right click in the Editor and select Insert Code...

3. Press ALT+INSERT


On 04/12/2017 05:09 AM, Zachary1234 wrote:

> -Is there an automatic way, or a working plugin way, to autogenerate
> getter and setter methods for some nominated class variable?
>
> -Where in the latest stable netbeans do I go to do this when programming?
>
> setSomeMethodName(int input)
> {
> this.number = input;
> }
>
>
> getSomeMethodName()
> {
> return this.number;
> }
>
>
>
>

Loading...