@PublicEvolving public enum TernaryBoolean extends Enum<TernaryBoolean>
A ternary boolean can for example be used to configuration switches that may be not configured (undefined), in which case a default value should be assumed.
枚举常量和说明 |
---|
FALSE
The value for 'false'.
|
TRUE
The value for 'true'.
|
UNDEFINED
The value for 'undefined'.
|
限定符和类型 | 方法和说明 |
---|---|
static TernaryBoolean |
fromBoolean(boolean bool)
|
static TernaryBoolean |
fromBoxedBoolean(Boolean bool)
Converts the given boxed Boolean to a TernaryBoolean.
|
Boolean |
getAsBoolean()
Gets this ternary boolean as a boxed boolean.
|
boolean |
getOrDefault(boolean defaultValue)
Gets the boolean value corresponding to this value.
|
TernaryBoolean |
resolveUndefined(boolean valueForUndefined)
Gets the boolean value corresponding to this value.
|
static TernaryBoolean |
valueOf(String name)
返回带有指定名称的该类型的枚举常量。
|
static TernaryBoolean[] |
values()
按照声明该枚举类型的常量的顺序, 返回
包含这些常量的数组。
|
public static final TernaryBoolean TRUE
public static final TernaryBoolean FALSE
public static final TernaryBoolean UNDEFINED
public static TernaryBoolean[] values()
for (TernaryBoolean c : TernaryBoolean.values()) System.out.println(c);
public static TernaryBoolean valueOf(String name)
name
- 要返回的枚举常量的名称。IllegalArgumentException
- 如果该枚举类型没有带有指定名称的常量NullPointerException
- 如果参数为空值public boolean getOrDefault(boolean defaultValue)
defaultValue
- The value to be returned in case this ternary value is 'undefined'.public TernaryBoolean resolveUndefined(boolean valueForUndefined)
valueForUndefined
- The value to be returned in case this ternary value is 'undefined'.@Nullable public Boolean getAsBoolean()
public static TernaryBoolean fromBoolean(boolean bool)
public static TernaryBoolean fromBoxedBoolean(@Nullable Boolean bool)
Copyright © 2014–2019 The Apache Software Foundation. All rights reserved.