[threeten-dev] [threeten-develop] TemporalAdder and TemporalSubtractor
Stephen Colebourne
scolebourne at joda.org
Fri Dec 21 09:35:30 PST 2012
On 21 December 2012 07:54, Xueming Shen <xueming.shen at oracle.com> wrote:
A TemporalPeriod concept is reasonable, however I don't think it
removes the need for Adder/Subtractor.
Consider the a balanced equivalence:
Temporal - defines the date-time type
TemporalAdjuster - deifnes how to make the adjustment
TemporalPeriod - defines the period type
TemporalAdder/Subtractor - defines how to add/subtract
Currently, we don't have TemporalPeriod, primarily because we don't
have period formatting (a useful thing for JDK9 maybe).
Under this balanced equivalence approach, the TemporalPeriod would
look something like this:
isSupported(Unit)
get(Unit)
getLong(Unit)
ie, it would provide access to the unit-long map, not the
addition/subtraction (which is what would be needed for a period
formatter)
By contrast, your chosen set of methods for TemporalPeriod are really
an extended set from Adder/Subtractor, and would not fulfil the period
formatter use case.
Stephen
More information about the threeten-dev
mailing list