From: Stephen Colebourne <scolebourne@jo...> - 2012-10-05 15:18:49
Key to this multi-calendar discussion is what methods each type of
developer should get.
The JDK provides
The key to the proposed design is using the two method styles as a
design motif to "push" developers to do what we want.
Firstly, only provide getFieldType() on concrete classes with a clear
and guaranteed Javadoc (eg. getMonth must be able to state the range
of possible return values).
Secondly, make users aware of the fact that there are two method
styles - get(field_type) and getFieldType(). Developers will naturally
use the latter whenever they can.
The "push" is that when the nice method is *not* present it presents a
real clue to developers that something else is going on here, and that
they should take extra caution. Which is exactly what we want them to
do given the higher probability of bugs.
Note that the alternate "push" we have been using up until now is to
use the class name to indicate the weaker guarantee. If you use
"ChronoDate" then the nice getFieldType() methods are ones you should
be careful with. With developers being told to ignore ChronoDate in