Re: [threeten-develop] Multi-Calendar API progress; dateFromEpochDay
Status: Alpha
Brought to you by:
scolebourne
From: Stephen C. <sco...@jo...> - 2012-10-30 00:42:17
|
On 29 October 2012 23:57, Roger Riggs <Rog...@or...> wrote: > On 10/27/2012 03:14 PM, Stephen Colebourne wrote: > The getEpochDay method was left over from EDR2 and is complementary > to Chronology.dateFromEpochDay. I would prefer that EPOCH_DAY not > appear in the high level API, developers have little direct use for it > and it is fine as just a field. > The chrono.dateFromEpochDay could be removed if it was satisfactory > to set the date from the field. > > While I think that toEpochDay() can potentially be removed more > generally, the factory of() method is the best way of creating from an > epoch-day, which is still necessary given it is the interchange field. > > For conversion/interchange, the Chronology.date(DateTimeAcessor dt) method > operates effectively by getLong(LocalDateTimeField.EPOCH_DAY) and creating > a chronology specific date from the value. > > A simplification is to make the dateFromEpochDay function private to the > implementation of XXXChronology.date(DateTimeAccessor). > > Is that sufficient? dateFromEpochDay() can go if it is practical to do so. I suspect doing so slightly increases the code in each chronology implementation, but not to the degree that it is a problem. Stephen |