java.util.Locale.getExtensionKeys()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(2.7k)|赞(0)|评价(0)|浏览(121)

本文整理了Java中java.util.Locale.getExtensionKeys()方法的一些代码示例,展示了Locale.getExtensionKeys()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Locale.getExtensionKeys()方法的具体详情如下:
包路径:java.util.Locale
类名称:Locale
方法名:getExtensionKeys

Locale.getExtensionKeys介绍

[英]Returns the set of extension keys associated with this locale, or the empty set if it has no extensions. The returned set is unmodifiable. The keys will all be lower-case.
[中]返回与此区域设置关联的扩展键集,如果没有扩展,则返回空集。返回的集是不可修改的。这些钥匙都是小写的。

代码示例

代码示例来源:origin: com.anrisoftware.globalpom/globalpomutils-core

/**
 * @see java.util.Locale#getExtensionKeys()
 */
public Set<Character> getExtensionKeys() {
  return locale.getExtensionKeys();
}

代码示例来源:origin: com.js-lib/js-commons

@Override
public boolean put(String name, T t, Locale... locale) {
  Params.notNullOrEmpty(name, "Name");
  Params.notNullOrEmpty(locale, "Locale");
  Params.empty(locale[0].getVariant(), "Locale variant");
  Params.empty(locale[0].getScript(), "Locale script");
  Params.empty(locale[0].getExtensionKeys(), "Locale extension");
  Map<String, T> maps = localeMaps.get(locale[0].toLanguageTag());
  if (maps == null) {
    maps = new HashMap<String, T>();
    localeMaps.put(locale[0].toLanguageTag(), maps);
  }
  return maps.put(name, t) != null;
}

代码示例来源:origin: com.js-lib/js-commons

/**
   * Get named objects map bound to requested locale settings.
   * 
   * @param locale locale settings to retrieve objects map for.
   * @return objects map bound to requested locale settings.
   * @throws IllegalArgumentException if <code>locale</code> argument has variant, script or extension.
   */
  private Map<String, T> maps(Locale locale) {
    Params.empty(locale.getVariant(), "Locale variant");
    Params.empty(locale.getScript(), "Locale script");
    Params.empty(locale.getExtensionKeys(), "Locale extension");
    Map<String, T> maps = localeMaps.get(locale.toLanguageTag());
    if (maps == null) {
      throw new BugError("Missing repository for locale |%s|.", locale);
    }
    return maps;
  }
}

代码示例来源:origin: com.js-lib/js-commons

/**
 * Construct I18N file instance bound to specified locale settings. Given locale should be based only on language and
 * optional country, encoded with ISO 639 alpha-2, respective ISO 3166 alpha-2; script, variant and extension should be
 * empty.
 * 
 * @param file underlying filesystem file path,
 * @param locale locale settings.
 * @throws IllegalArgumentException if <code>locale</code> argument is null or has variant, script or extension.
 */
I18nFile(File file, Locale locale) throws IllegalArgumentException {
  this.file = file;
  Params.notNull(locale, "Locale");
  Params.empty(locale.getVariant(), "Locale variant");
  Params.empty(locale.getScript(), "Locale script");
  Params.empty(locale.getExtensionKeys(), "Locale extension");
  this.locale = locale;
}

相关文章