public static enum Locale.FilteringMode extends Enum<Locale.FilteringMode>
例如,考虑两个语言优先级列表,每个语言优先级列表只包含一个语言范围和一组以下语言标签:
de (German)
de-DE (German, Germany)
de-Deva (German, in Devanagari script)
de-Deva-DE (German, in Devanagari script, Germany)
de-DE-1996 (German, Germany, orthography of 1996)
de-Latn-DE (German, in Latin script, Germany)
de-Latn-DE-1996 (German, in Latin script, Germany, orthography of 1996)
过滤方法的行为如下:
Filtering Mode Language Priority List: "de-DE"
Language Priority List: "de-*-DE"
AUTOSELECT_FILTERING
Performs basic filtering and returns "de-DE"
and "de-DE-1996"
. Performs extended filtering and returns "de-DE"
, "de-Deva-DE"
, "de-DE-1996"
, "de-Latn-DE"
, and "de-Latn-DE-1996"
. EXTENDED_FILTERING
Performs extended filtering and returns "de-DE"
, "de-Deva-DE"
, "de-DE-1996"
, "de-Latn-DE"
, and "de-Latn-DE-1996"
. Same as above. IGNORE_EXTENDED_RANGES
Performs basic filtering and returns "de-DE"
and "de-DE-1996"
. Performs basic filtering and returns null
because nothing matches. MAP_EXTENDED_RANGES
Same as above. Performs basic filtering and returns "de-DE"
and "de-DE-1996"
because "de-*-DE"
is mapped to "de-DE"
. REJECT_EXTENDED_RANGES
Same as above. Throws IllegalArgumentException
because "de-*-DE"
is not a valid basic language range.
Enum Constant and Description |
---|
AUTOSELECT_FILTERING
指定基于由语言范围组成的给定语言优先级列表的自动过滤模式。
|
EXTENDED_FILTERING
指定扩展过滤。
|
IGNORE_EXTENDED_RANGES
指定基本过滤:请注意,给定语言优先级列表中包含的任何扩展语言范围都将被忽略。
|
MAP_EXTENDED_RANGES
指定基本过滤:如果任何扩展语言范围包含在给定的语言优先级列表中,它们将映射到基本语言范围。
|
REJECT_EXTENDED_RANGES
指定基本过滤:如果任何扩展语言范围包含在给定的语言优先级列表中,列表将被拒绝,并且过滤方法将抛出 IllegalArgumentException 。
|
Modifier and Type | Method and Description |
---|---|
static Locale.FilteringMode |
valueOf(String name)
以指定的名称返回此类型的枚举常量。
|
static Locale.FilteringMode[] |
values()
按照它们声明的顺序返回一个包含此枚举类型常量的数组。
|
public static final Locale.FilteringMode AUTOSELECT_FILTERING
public static final Locale.FilteringMode EXTENDED_FILTERING
public static final Locale.FilteringMode IGNORE_EXTENDED_RANGES
public static final Locale.FilteringMode MAP_EXTENDED_RANGES
"*"
的语言范围被视为语言范围"*"
。
例如, "*-US"
被视为"*"
。
如果"*"
不是第一"*"
标签, "*"
和额外的"-"
被删除。
例如, "ja-*-JP"
被映射到"ja-JP"
。
public static final Locale.FilteringMode REJECT_EXTENDED_RANGES
IllegalArgumentException
。
public static Locale.FilteringMode[] values()
for (Locale.FilteringMode c : Locale.FilteringMode.values())
System.out.println(c);
public static Locale.FilteringMode valueOf(String name)
name
- 要返回的枚举常量的名称。
IllegalArgumentException
- 如果此枚举类型没有指定名称的常量
NullPointerException
- 如果参数为空
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.