bean naming conventions -> getter/setter
When I have a field called e.g. xCoordinate it appears to me that the getter shoud be named getXCoordinate().
Why? Because "get" is clearly a name standard in Java, then "X" and "Coordinate" are distinguishable by the case shift (small x -> big C) so "X" is is clearly the start and end of a word at the same time and should be capitalized.
Now IntelliJ auto-creates a getter called "getxCoordinate". Even though Eclipse does the same, it still appears to me that this is wrong since there is no more distinction between "get" "X" and "Coordinate" rather "getx" forms a non-existing term. Why is this so?
Please sign in to leave a comment.
That is related to javabeans specification. Consider a sample below:
It produces the following (notice 'YCoordinate' instead of 'yCoordinate'):
Denis
If you are currious why it does this, section 8.8 Capitalization of inferred names of the Javabeans Specification explains it. It's basically to prevent getURL from seeing the property name as uRL.
Here's the section (empahsis added):