(String zoneId)
| 10 | } |
| 11 | |
| 12 | public static ZoneId of(String zoneId) { |
| 13 | if (zoneId == null) { |
| 14 | throw new NullPointerException(); |
| 15 | } |
| 16 | if ("Z".equals(zoneId) || "UTC".equals(zoneId) || "GMT".equals(zoneId)) { |
| 17 | return ZoneOffset.UTC; |
| 18 | } |
| 19 | if (zoneId.startsWith("+") || zoneId.startsWith("-")) { |
| 20 | return ZoneOffset.of(zoneId); |
| 21 | } |
| 22 | if (zoneId.startsWith("UTC+") || zoneId.startsWith("UTC-")) { |
| 23 | return ZoneOffset.of(zoneId.substring(3)); |
| 24 | } |
| 25 | if (zoneId.startsWith("GMT+") || zoneId.startsWith("GMT-")) { |
| 26 | return ZoneOffset.of(zoneId.substring(3)); |
| 27 | } |
| 28 | return new ZoneId(zoneId); |
| 29 | } |
| 30 | |
| 31 | public static ZoneId systemDefault() { |
| 32 | return of(TimeZone.getDefault().getID()); |
no test coverage detected