0N/A/*
2362N/A * Copyright (c) 2005, 2007, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/A/*
0N/A * (C) Copyright Taligent, Inc. 1996, 1997 - All Rights Reserved
0N/A * (C) Copyright IBM Corp. 1996 - 1998 - All Rights Reserved
0N/A *
0N/A * The original version of this source code and documentation
0N/A * is copyrighted and owned by Taligent, Inc., a wholly-owned
0N/A * subsidiary of IBM. These materials are provided under terms
0N/A * of a License Agreement between Taligent and Sun. This technology
0N/A * is protected by multiple US and International patents.
0N/A *
0N/A * This notice and attribution to Taligent may not be removed.
0N/A * Taligent is a registered trademark of Taligent, Inc.
0N/A *
0N/A */
0N/A
0N/Apackage sun.util.resources;
0N/A
0N/Aimport java.util.Map;
0N/Aimport java.util.LinkedHashMap;
0N/A
0N/A/**
0N/A * Subclass of <code>ResourceBundle</code> with special
0N/A * functionality for time zone names. The additional functionality:
0N/A * <ul>
0N/A * <li>Preserves the order of entries in the <code>getContents</code>
0N/A * array for the enumeration returned by <code>getKeys</code>.
0N/A * <li>Inserts the time zone ID (the key of the bundle entries) into
0N/A * the string arrays returned by <code>handleGetObject</code>.
0N/A * <ul>
0N/A * All <code>TimeZoneNames</code> resource bundles must extend this
0N/A * class and implement the <code>getContents</code> method.
0N/A */
0N/Apublic abstract class TimeZoneNamesBundle extends OpenListResourceBundle {
0N/A
0N/A /**
0N/A * Maps time zone IDs to locale-specific names.
0N/A * The value returned is an array of five strings:
0N/A * <ul>
0N/A * <li>The time zone ID (same as the key, not localized).
0N/A * <li>The long name of the time zone in standard time (localized).
0N/A * <li>The short name of the time zone in standard time (localized).
0N/A * <li>The long name of the time zone in daylight savings time (localized).
0N/A * <li>The short name of the time zone in daylight savings time (localized).
0N/A * </ul>
0N/A * The localized names come from the subclasses's
0N/A * <code>getContents</code> implementations, while the time zone
0N/A * ID is inserted into the returned array by this method.
0N/A */
0N/A public Object handleGetObject(String key) {
0N/A String[] contents = (String[]) super.handleGetObject(key);
0N/A if (contents == null) {
0N/A return null;
0N/A }
0N/A
0N/A int clen = contents.length;
0N/A String[] tmpobj = new String[clen+1];
0N/A tmpobj[0] = key;
0N/A for (int i = 0; i < clen; i++) {
0N/A tmpobj[i+1] = contents[i];
0N/A }
0N/A return tmpobj;
0N/A }
0N/A
0N/A /**
0N/A * Use LinkedHashMap to preserve order of bundle entries.
0N/A */
0N/A protected Map createMap(int size) {
0N/A return new LinkedHashMap(size);
0N/A }
0N/A
0N/A /**
0N/A * Provides key/value mappings for a specific
0N/A * resource bundle. Each entry of the array
0N/A * returned must be an array with two elements:
0N/A * <ul>
0N/A * <li>The key, which must be a string.
0N/A * <li>The value, which must be an array of
0N/A * four strings:
0N/A * <ul>
0N/A * <li>The long name of the time zone in standard time.
0N/A * <li>The short name of the time zone in standard time.
0N/A * <li>The long name of the time zone in daylight savings time.
0N/A * <li>The short name of the time zone in daylight savings time.
0N/A * </ul>
0N/A * </ul>
0N/A */
0N/A protected abstract Object[][] getContents();
0N/A}