开发者

How do you force Eclipse to prompt you to create a getter and setter when it doesn't do it automatically?

开发者 https://www.devze.com 2023-01-18 14:57 出处:网络
I added two private fields to my Java class. Eclipse prompted me to automatically create a getter and setter for one of them.

I added two private fields to my Java class.

Eclipse prompted me to automatically create a getter and setter for one of them.

How do I get it 开发者_如何转开发to do the same for the other one that it 'forgot' about?


Fastest way for people that don't need a mouse anymore: with an editor in focus, press ALT+s, r.


Yet another method: move your cursor over the field definition, press Ctrl+1, and select "create getter and setter for (field)".


editor view -> right click -> source -> generate getters and setters


To create a getter/setter the fastest way is to type get (or set) + Ctrl + Space and you will see it in the pop-up proposal list.

0

精彩评论

暂无评论...
验证码 换一张
取 消