On 22 February 2010 23:57, David Jarvis <thanga...@gmail.com> wrote: > if (datetime.getMonthOfYear() == 2) { // February is month 2!! > > I think it would read better as: > > if( datetime.isMonth( DateTimeConstants.FEBRUARY ) ) {
I guess I wanted to emphasise that months were indexed from 1. Your argument is sound, so I'll have to have a think. > And even better as: > > public boolean isAfterPayDay(DateTime datetime) { > > return datetime.getDayOfMonth() > datetime.getDaysInMonth() - 2; > } I think you've changed the logic here (in leap years) :-) > Which implies API changes: > boolean DateTime.isYear( int ) > boolean DateTime.isMonth( int ) > boolean DateTime.isWeek( int ) (same as isWeekOfYear) > boolean DateTime.isDay( int ) (same as isDayOfYear) > boolean DateTime.isDayOfYear( int ) > boolean DateTime.isDayOfMonth( int ) > boolean DateTime.isDayOfWeek( int ) > boolean DateTime.isWeekOfYear( int ) > boolean DateTime.isWeekOfMonth( int ) > boolean DateTime.isDayOfWeekAfter( int ) > boolean DateTime.isDayOfMonthAfter( int ) > boolean DateTime.isDayOfYearAfter( int ) > boolean DateTime.isDayOfWeekBefore( int ) > boolean DateTime.isDayOfMonthBefore( int ) > boolean DateTime.isDayOfYearBefore( int ) > int DateTime.getDaysInWeek() (superfluous; always seven across all > calendars?) > int DateTime.getDaysInMonth() > int DateTime.getDaysInYear() The question with any API like Joda-Time is how far to go in fluent/convenience. I've stayed away from this level, as the alternative (==) isn't that bad. Thanks for the feedback though. I'll have a think about the examples. (And feel free to review JSR-310!) Stephen ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Joda-interest mailing list Joda-interest@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/joda-interest