[threeten-dev] ZoneOffsetInfo

Stephen Colebourne scolebourne at joda.org
Sat Nov 17 09:19:43 PST 2012


I've pushed a change that removes ZoneOffsetInfo. The interface was
useful for avoiding having to search the rules twice for the same
data. However, a combination of additional methods solves the problem
similar to what you suggest below.

There should be an effort to improve the performance of the LDT lookup
at some point, as it seems slow compared to the JDK.

Stephen

> On 16 November 2012 23:35, Xueming Shen <xueming.shen at oracle.com> wrote:
>> Hi Stephen,
>>
>> Given its only method boolean isValidOffset(ZoneOffset), just wonder if this
>> interface really deserves a place here. Personally it does not appear to me
>> to be a natural fit to have an interface to simply provide a common
>> interface
>> for ZoneOffset and ZoneOffsetTransition, especially given the implementation
>> notes "this interface must not be implemented by application...."
>>
>> From the use scenario in ZoneDateTime, it might be more straightforward to
>> simply replace
>>
>>      ZoneRules.getOffsetInfo(LocalDateTime)
>>
>> with more direct
>>
>>     ZoneOffsetTransition ZoneRules.getOffsetTransition(LocalDateTime)
>>
>> which returns null if not in transition
>>
>> and
>>
>>     ZoneOffset ZoneRules.getOffsetSet(LocalDateTime)
>>
>> which returns null if is in transition
>>
>> and a "useful" assistant method,if necessary
>>
>>     boolean ZoneRules.isOffsetTransition().
>>
>> for scenario that you only care whether or not it's a transition.
>>
>>
>> I'm not sure what you really expect the people to do with the "info"
>> returned
>> from
>>
>> ZoneOffsetInto ZoneRules.getOffsetInfo(LocalDateTime)
>>
>> If people have to do instanceof ZOT or ZO anyway, I feel it might be better
>> just provide
>> the straightforward methods in ZR class. I would assume most use case here
>> is to ask
>> the ZR if a LDT is in transition, if yes go get a ZOT, if no, go get a ZO.
>> If so I don't see too
>> much value-add to have such an abstraction flying around, though understood
>> the name
>> "ZoneOffInfo" is attractive.
>>
>> Thanks!
>> -Sherman
>>


More information about the threeten-dev mailing list