src/share/classes/sun/util/locale/provider/FallbackLocaleProviderAdapter.java

Print this page
rev 7121 : imported patch 8013903


   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package sun.util.locale.provider;
  27 





  28 /**
  29  * FallbackProviderAdapter implementation.
  30  *
  31  * @author Naoto Sato
  32  */
  33 public class FallbackLocaleProviderAdapter extends JRELocaleProviderAdapter {
  34 
  35     /**
















  36      * Returns the type of this LocaleProviderAdapter
  37      */
  38     @Override
  39     public LocaleProviderAdapter.Type getAdapterType() {
  40         return Type.FALLBACK;
  41     }










  42 }


   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package sun.util.locale.provider;
  27 
  28 import java.util.Collections;
  29 import java.util.HashSet;
  30 import java.util.Locale;
  31 import java.util.Set;
  32 
  33 /**
  34  * FallbackProviderAdapter implementation.
  35  *
  36  * @author Naoto Sato
  37  */
  38 public class FallbackLocaleProviderAdapter extends JRELocaleProviderAdapter {
  39 
  40     /**
  41      * Supported language tag set.
  42      */
  43     private static final Set<String> rootTagSet;
  44     static {
  45         Set<String> tmp = new HashSet<>();
  46         tmp.add(Locale.ROOT.toLanguageTag());
  47         rootTagSet = Collections.unmodifiableSet(tmp);
  48     }
  49 
  50     /**
  51      * Fallback provider only provides the ROOT locale data.
  52      */
  53     private final LocaleResources rootLocaleResources =
  54         new LocaleResources(this, Locale.ROOT);
  55 
  56     /**
  57      * Returns the type of this LocaleProviderAdapter
  58      */
  59     @Override
  60     public LocaleProviderAdapter.Type getAdapterType() {
  61         return Type.FALLBACK;
  62     }
  63 
  64     @Override
  65     public LocaleResources getLocaleResources(Locale locale) {
  66         return rootLocaleResources;
  67     }
  68 
  69     @Override
  70     protected Set<String> createLanguageTagSet(String category) {
  71         return rootTagSet;
  72     }
  73 }