0

I have a question on eclipse settings.

I want to declare some variables having special characters in it i.e. m_memberVar etc and want to generate the getter and setter by eliminating the special character and in standard format i.e. for above variable, the getter and setter method will be

public void setMemberVar(DataType dt) {}

and public ReturnType getMemberVar() {}

But the default settings in eclipse does not generate above methods instead generates getM_memberVar() and setM_memberVar().

Is it possible to settings accordingly so that above requirement can be fulfilled? Can I prepare some xml file with all editor related settings I require in my project and import it in eclipse?

Thanks in advance and waiting for your reply.

Rohan
  • 3,068
  • 1
  • 20
  • 26
java developer
  • 484
  • 1
  • 5
  • 9

1 Answers1

0

Don't use m_ or p_ as prefixes. Eclipse shows such variables in different colors so the difference is obvious. And it really isn't a good practice to use this prefixes it just clutters your code in my opinion.

Kai
  • 38,985
  • 14
  • 88
  • 103
  • Thanks for reply. But I went through some code in google and in other codebase and found that this is common practice to use m_ as prefix for member variables. – java developer May 24 '13 at 08:12
  • @javadeveloper maybe it was 10 years ago and now this is legacy code. When you start a new project you should stick to more modern style of coding. – Kai May 24 '13 at 08:15
  • @javadeveloper see [What are the benefits of prefixing function parameter names with p*?](http://programmers.stackexchange.com/questions/161283/what-are-the-benefits-of-prefixing-function-parameter-names-with-p) and [Why shouldn't I use “Hungarian Notation”?](http://stackoverflow.com/questions/111933/why-shouldnt-i-use-hungarian-notation) for more opinions on that. – Kai May 24 '13 at 08:22