< prev index next >
make/jdk/src/classes/build/tools/cldrconverter/MetaZonesParseHandler.java
Print this page
rev 49533 : [mq]: 8189784
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -25,17 +25,24 @@
package build.tools.cldrconverter;
import java.io.File;
import java.io.IOException;
+import java.util.*;
+import java.util.stream.*;
+
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
class MetaZonesParseHandler extends AbstractLDMLHandler<String> {
private String tzid, metazone;
+ // for java.time.format.ZoneNames.java
+ private List<String> mzoneMapEntryList = new ArrayList<>();
+ private Map<String, String> zones = new HashMap<>();
+
MetaZonesParseHandler() {
}
@Override
public InputSource resolveEntity(String publicID, String systemID) throws IOException, SAXException {
@@ -62,10 +69,23 @@
metazone = attributes.getValue("mzone");
}
pushIgnoredContainer(qName);
break;
+ case "mapZone":
+ String territory = attributes.getValue("territory");
+ if (territory.equals("001")) {
+ zones.put(attributes.getValue("other"), attributes.getValue("type"));
+ } else {
+ mzoneMapEntryList.add(String.format(" \"%s\", \"%s\", \"%s\",",
+ attributes.getValue("other"),
+ territory,
+ attributes.getValue("type")));
+ }
+ pushIgnoredContainer(qName);
+ break;
+
case "version":
case "generation":
pushIgnoredContainer(qName);
break;
@@ -87,6 +107,14 @@
put(tzid, metazone);
break;
}
currentContainer = currentContainer.getParent();
}
+
+ public Map<String, String> zidMap() {
+ return zones;
+ }
+
+ public Stream<String> mzoneMapEntry() {
+ return mzoneMapEntryList.stream();
+ }
}
< prev index next >