jdk/src/share/classes/sun/util/locale/Extension.java
author okutsu
Thu, 14 Apr 2011 15:59:47 +0900
changeset 9224 75c0420badef
parent 6501 684810d882b3
permissions -rw-r--r--
7028818: (lc) Lazily initialize locale extension 7029740: (lc) New Locale class implementation doesn't follow the Java coding conventions 7032820: (lc) sun.util.locale.InternalLocaleBuilder.CaseInsensitiveChar.equals problems 7033503: (lc) Restore optimization code for Locale class initialization 7033504: (lc) incompatible behavior change for ja_JP_JP and th_TH_TH locales Reviewed-by: naoto
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6501
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
     1
/*
9224
75c0420badef 7028818: (lc) Lazily initialize locale extension
okutsu
parents: 6501
diff changeset
     2
 * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
6501
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
     4
 *
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
    10
 *
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
    15
 * accompanied this code).
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
    16
 *
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
    20
 *
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
    23
 * questions.
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
    24
 */
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
    25
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
    26
/*
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
    27
 *******************************************************************************
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
    28
 * Copyright (C) 2009-2010, International Business Machines Corporation and    *
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
    29
 * others. All Rights Reserved.                                                *
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
    30
 *******************************************************************************
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
    31
 */
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
    32
package sun.util.locale;
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
    33
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
    34
9224
75c0420badef 7028818: (lc) Lazily initialize locale extension
okutsu
parents: 6501
diff changeset
    35
class Extension {
75c0420badef 7028818: (lc) Lazily initialize locale extension
okutsu
parents: 6501
diff changeset
    36
    private final char key;
75c0420badef 7028818: (lc) Lazily initialize locale extension
okutsu
parents: 6501
diff changeset
    37
    private String value, id;
6501
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
    38
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
    39
    protected Extension(char key) {
9224
75c0420badef 7028818: (lc) Lazily initialize locale extension
okutsu
parents: 6501
diff changeset
    40
        this.key = key;
6501
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
    41
    }
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
    42
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
    43
    Extension(char key, String value) {
9224
75c0420badef 7028818: (lc) Lazily initialize locale extension
okutsu
parents: 6501
diff changeset
    44
        this.key = key;
75c0420badef 7028818: (lc) Lazily initialize locale extension
okutsu
parents: 6501
diff changeset
    45
        setValue(value);
75c0420badef 7028818: (lc) Lazily initialize locale extension
okutsu
parents: 6501
diff changeset
    46
    }
75c0420badef 7028818: (lc) Lazily initialize locale extension
okutsu
parents: 6501
diff changeset
    47
75c0420badef 7028818: (lc) Lazily initialize locale extension
okutsu
parents: 6501
diff changeset
    48
    protected void setValue(String value) {
75c0420badef 7028818: (lc) Lazily initialize locale extension
okutsu
parents: 6501
diff changeset
    49
        this.value = value;
75c0420badef 7028818: (lc) Lazily initialize locale extension
okutsu
parents: 6501
diff changeset
    50
        this.id = key + LanguageTag.SEP + value;
6501
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
    51
    }
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
    52
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
    53
    public char getKey() {
9224
75c0420badef 7028818: (lc) Lazily initialize locale extension
okutsu
parents: 6501
diff changeset
    54
        return key;
6501
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
    55
    }
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
    56
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
    57
    public String getValue() {
9224
75c0420badef 7028818: (lc) Lazily initialize locale extension
okutsu
parents: 6501
diff changeset
    58
        return value;
6501
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
    59
    }
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
    60
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
    61
    public String getID() {
9224
75c0420badef 7028818: (lc) Lazily initialize locale extension
okutsu
parents: 6501
diff changeset
    62
        return id;
6501
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
    63
    }
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
    64
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
    65
    public String toString() {
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
    66
        return getID();
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
    67
    }
684810d882b3 6875847: Java Locale Enhancement
naoto
parents:
diff changeset
    68
}