jdk/src/share/classes/sun/util/locale/Extension.java
changeset 9224 75c0420badef
parent 6501 684810d882b3
equal deleted inserted replaced
9223:d331b7996fc3 9224:75c0420badef
     1 /*
     1 /*
     2  * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    30  *******************************************************************************
    30  *******************************************************************************
    31  */
    31  */
    32 package sun.util.locale;
    32 package sun.util.locale;
    33 
    33 
    34 
    34 
    35 public class Extension {
    35 class Extension {
    36     private char _key;
    36     private final char key;
    37     protected String _value;
    37     private String value, id;
    38 
    38 
    39     protected Extension(char key) {
    39     protected Extension(char key) {
    40         _key = key;
    40         this.key = key;
    41     }
    41     }
    42 
    42 
    43     Extension(char key, String value) {
    43     Extension(char key, String value) {
    44         _key = key;
    44         this.key = key;
    45         _value = value;
    45         setValue(value);
       
    46     }
       
    47 
       
    48     protected void setValue(String value) {
       
    49         this.value = value;
       
    50         this.id = key + LanguageTag.SEP + value;
    46     }
    51     }
    47 
    52 
    48     public char getKey() {
    53     public char getKey() {
    49         return _key;
    54         return key;
    50     }
    55     }
    51 
    56 
    52     public String getValue() {
    57     public String getValue() {
    53         return _value;
    58         return value;
    54     }
    59     }
    55 
    60 
    56     public String getID() {
    61     public String getID() {
    57         return _key + LanguageTag.SEP + _value;
    62         return id;
    58     }
    63     }
    59 
    64 
    60     public String toString() {
    65     public String toString() {
    61         return getID();
    66         return getID();
    62     }
    67     }