[threeten-dev] ZoneIdPrinterParser #262

Stephen Colebourne scolebourne at joda.org
Mon Jun 10 08:35:06 PDT 2013


On 8 June 2013 18:34, roger riggs <roger.riggs at oracle.com> wrote:
> Please review the changes and comment whether the test cases are correct.
> There are a number of input values that were previously valid for parsing
> of ZoneIds that are no longer valid (to match ZoneId).  For example,  "UTC0"
> is no longer valid.

Looks right to me. It may be worth a cross-test with ZoneId.of to
ensure both work the same.

> One inconvenience in the code after a prefix and the offset value is parsed
> there is no public method to create the ZoneId.  The ZoneId.of method as to
> re-parse the input.
> The method   static ZoneRegion ofPrefixedOffset(String zoneId, ZoneOffset
> offset)
> is use for this purpose but it is package private and can't be used from the
> format package.
> Is it reasonable to add a method to ZoneId for a similar purpose?

I think adding a ZoneId.ofOffset(String prefix, ZoneOffset offset)
method would be OK. I don't think it needs a longer name than
"ofOffset" because the arguments and javadoc should be clear enough. I
think that as well as "UTC, "UT" and "GMT" prefixes, it should accept
a blank string, which just returns the offset.

thanks
Stephen


> http://cr.openjdk.java.net/~rriggs/webrev-zoneid-parser-262/
>
> Thanks, Roger
>
>
>


More information about the threeten-dev mailing list