Eclipse generate getter setter tip to deal with field prefixes suffixes

Here is a nifty feature I found in Eclipse regarding generating getters and setters. Normally the names Eclipse assigns to the getter and setter methods are the field names as-is suffixed to get and set. For e.g. if you have a field called “lastName” – the getter would be getLastName() and the setter would be setLastName(). Now some people follow coding conventions by prefixing fields with a certain letter to indicate they are class level variables.  e.g. mLastName, mFirstName etc.  In such a case when Eclipse is used to generate getters/setters, then the method names become getmLastName(), setmLastName() etc.  Those names are nothing short of disgusting:

Getter Setter method name with field prefix
Getter/setter name has field prefix

Fortunately this can be easily fixed.  You can tell Eclipse that you prefix/suffix your fields in a certain way and the prefix/suffix will automatically be removed from the generated getters and setters. Click on Window -> Preferences -> Java -> Code Style.  Select Fields and click on Edit to specify the field name conventions.

Set field name conventions
Set field name convention

Now, things are looking good.

Getter/Setter without field prefix
Getter/Setter without field prefix

Eclipse, what would life be without it ?

The book of Mozilla

Try this for some fun. Type about:mozilla in the URL bar in Firefox and hit enter.

Quote from the Book of Mozilla
Quote from the Book of Mozilla

Yup, you get a quote in biblical style about Mozilla. This is what I saw in my Firefox 3.6.10:

“Mammon slept. And the beast reborn spread over the earth and its numbers grew legion. And they proclaimed the times and sacrificed crops unto the fire, with the cunning of foxes. And they built a new world in their own image as promised by the  sacred words, and spoke of the beast with their children.Mammon awoke, and lo! it was naught but a follower.”

How cool is that ?  In case you haven’t guessed it, “Mammon”  refers to Internet Explorer.  So you can see how the quote refers to Firefox becoming popular and finally when IE 7 came out, it copied several Firefox features. Turns out these quotes have been part of the Firefox browser ever since the Netscape days.  Wikipedia of course has the whole story superbly covered.

This reminds me of one of my all-time favorite movie scenes. Yes, of course the Pulp Fiction Breakfast scene where Samuel Jackson quotes from the bible.

“The path of the righteous man is beset on all sides by the iniquities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother’s keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee.”

Pure Gold.