AFAIK, the naming pattern of fields is not part of the JavaBeans specification.
The JavaBeans Specification specifies (among others) the "properties" concept.
The properties of a class are identified by the methods (named after a certain pattern) of a class.
The fields are irrelevant. In fact, there doesn't even have to be a field for a property.
That said, it's still a good practice to name the fields after the property names. The chance is greater that tools which need to access the fields as well (e.g. refactoring support in IDEs) will handle the fields correctly.
Having a property named isXXX and a getter being isXXX instead of isIsXXX: is it a valid Java Bean definition?
No, a getter for a property isXXX
requires isIsXXX()
(for boolean) or getIsXXX()
.
But again it's the other way around.
If you have a method:
boolean isXyz()
then you have a readable property xyz
.
If you have a method
boolean isIsXyz()
then you have a readable property isXyz
.
For more information have a look at the Introspector class, the tutorial or the JavaBeans Specification:
http://www.oracle.com/technetwork/java/javase/documentation/spec-136004.html
http://www.oracle.com/technetwork/java/javase/tech/index-jsp-138795.html