views:

115

answers:

2

eclipse supports naming conventions for fields, parameters and local variables. For each variable type it is possible to configure a list of prefix or suffix or both. eclipse respects this configuration when generating methods or getters/setters. is there a similar configuration option in netbeans? is there another way to achieve the same thing: i want to get parameters with prefixes, when generating implementations for abstract methods and i want the prefix to be removed, when generating getters/setters (example: for _myVar it should generate getMyVar and setMyVar).

A: 

Just curious to know... How you achieve it in eclipse ?

Thanks

Samra
You can tell eclipse about your java naming conventions in the code-style section of preferences. See http://help.eclipse.org/galileo/topic/org.eclipse.jdt.doc.user/reference/preferences/java/ref-preferences-code-style.htm Eclipse Online Help - Code Style. As the documentation mentions: "Naming conventions are used by all actions and 'Quick Fix' proposals that create fields, parameters and local variables"
A: 

You can use Alt + Insert to generate some feature you need like getter and setter and constructors and ... . when you change something you can use re-factor.

SjB
thanks, but thats not exactly what im looking for. i don't want to refactor afterwards, when generating an implementation for an abstract method to get all parameters prefixed with a "p" (for example: getTranslatedString(String pKey, Locale pLocale). Or rename the generated getters/setter for fMyVar from getFMyVar to getMyVar and setFMyVar to setMyVar. I was hoping, that i could teach NetBeans to regard my coding conventions and automatically add or remove my prefixes as appropriate when generating code.