jdk/test/java/util/ResourceBundle/TestResource_fr.java
changeset 2 90ce3da70b43
child 5506 202f599c92aa
equal deleted inserted replaced
0:fd16c54261b3 2:90ce3da70b43
       
     1 /*
       
     2  * Copyright (c) 2007 Sun Microsystems, Inc.  All Rights Reserved.
       
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     4  *
       
     5  * This code is free software; you can redistribute it and/or modify it
       
     6  * under the terms of the GNU General Public License version 2 only, as
       
     7  * published by the Free Software Foundation.
       
     8  *
       
     9  * This code is distributed in the hope that it will be useful, but WITHOUT
       
    10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    12  * version 2 for more details (a copy is included in the LICENSE file that
       
    13  * accompanied this code).
       
    14  *
       
    15  * You should have received a copy of the GNU General Public License version
       
    16  * 2 along with this work; if not, write to the Free Software Foundation,
       
    17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    18  *
       
    19  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
       
    20  * CA 95054 USA or visit www.sun.com if you need additional information or
       
    21  * have any questions.
       
    22  */
       
    23 /*
       
    24  *
       
    25  *
       
    26  * (C) Copyright Taligent, Inc. 1996, 1997 - All Rights Reserved
       
    27  * (C) Copyright IBM Corp. 1996 - 1998 - All Rights Reserved
       
    28  *
       
    29  * Portions copyright (c) 2007 Sun Microsystems, Inc.
       
    30  * All Rights Reserved.
       
    31  *
       
    32  * The original version of this source code and documentation
       
    33  * is copyrighted and owned by Taligent, Inc., a wholly-owned
       
    34  * subsidiary of IBM. These materials are provided under terms
       
    35  * of a License Agreement between Taligent and Sun. This technology
       
    36  * is protected by multiple US and International patents.
       
    37  *
       
    38  * This notice and attribution to Taligent may not be removed.
       
    39  * Taligent is a registered trademark of Taligent, Inc.
       
    40  *
       
    41  * Permission to use, copy, modify, and distribute this software
       
    42  * and its documentation for NON-COMMERCIAL purposes and without
       
    43  * fee is hereby granted provided that this copyright notice
       
    44  * appears in all copies. Please refer to the file "copyright.html"
       
    45  * for further important copyright and licensing information.
       
    46  *
       
    47  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
       
    48  * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
       
    49  * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
       
    50  * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR
       
    51  * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
       
    52  * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
       
    53  *
       
    54  */
       
    55 
       
    56 // NOTE:  This class is part of the ResourceBundleTest.
       
    57 
       
    58 import java.util.*;
       
    59 
       
    60 public class TestResource_fr extends ResourceBundle {
       
    61     public TestResource_fr() {
       
    62     }
       
    63 
       
    64     public Object handleGetObject(String key) throws MissingResourceException {
       
    65         if (key.equals("Time"))
       
    66             return "Time keeps on slipping...";
       
    67         else if (key.equals("For"))
       
    68             return "Four score and seven years ago...";
       
    69         else if (key.equals("All")) {
       
    70             String[] values = {
       
    71                 "'Twas brillig, and the slithy toves",
       
    72                 "Did gyre and gimble in the wabe.",
       
    73                 "All mimsy were the borogoves,",
       
    74                 "And the mome raths outgrabe."
       
    75             };
       
    76             return values;
       
    77         }
       
    78         else if (key.equals("Good"))
       
    79             return new Integer(3);
       
    80         else
       
    81             return null;
       
    82     }
       
    83 
       
    84     public Enumeration getKeys() {
       
    85         Hashtable keys = new Hashtable();
       
    86 
       
    87         keys.put("Time", "Time");
       
    88         keys.put("For", "For");
       
    89         keys.put("All", "All");
       
    90         keys.put("Good", "Good");
       
    91 
       
    92         Enumeration parentKeys = parent.getKeys();
       
    93         while (parentKeys.hasMoreElements()) {
       
    94             Object  elt = parentKeys.nextElement();
       
    95             keys.put(elt, elt);
       
    96         }
       
    97 
       
    98         return keys.elements();
       
    99     }
       
   100 }