Package com.helger.commons.state
Enum ETriState
- All Implemented Interfaces:
IHasID<String>,ITriState,Serializable,Comparable<ETriState>,java.lang.constant.Constable
Represents an object that has one of 3 different states compared to a boolean
that has only 2 different states.
- Author:
- Philip Helger
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionConvert the tri state value into aBooleanvalue, depending on what "undefined" means.getAsBooleanObj(Boolean aUndefinedValue) Convert the tri state value into aBooleanvalue, depending on what "undefined" means.booleanConvert the tri state value into a boolean value.booleangetAsBooleanValue(boolean bUndefinedValue) Convert the tri state value into a boolean value, depending on what "undefined" means.static ETriStategetFromIDOrDefault(String sID, ETriState eDefault) static ETriStategetFromIDOrNull(String sID) static ETriStategetID()Get the unique ID of this object.booleanbooleanisFalse()booleanisTrue()static ETriStatevalueOf(boolean bValue) Returns the enum constant of this type with the specified name.static ETriStateReturns the enum constant of this type with the specified name.static ETriStateReturns the enum constant of this type with the specified name.static ETriStateReturns the enum constant of this type with the specified name.static ETriState[]values()Returns an array containing the constants of this enum type, in the order they are declared.Methods inherited from class java.lang.Enum
clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOfMethods inherited from interface com.helger.commons.state.ITriState
getAsBooleanObj, isUndefined
-
Enum Constant Details
-
TRUE
-
FALSE
-
UNDEFINED
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
getID
Description copied from interface:IHasIDGet the unique ID of this object. If the type isStringthan the returned value must match an XML NMToken expression (so e.g. no ':' in the ID)! -
isTrue
public boolean isTrue() -
isFalse
public boolean isFalse() -
isDefined
public boolean isDefined() -
getAsBooleanValue
public boolean getAsBooleanValue()Description copied from interface:ITriStateConvert the tri state value into a boolean value. If it is undefined, anIllegalStateExceptionis thrown.- Specified by:
getAsBooleanValuein interfaceITriState- Returns:
trueifITriState.isTrue()is true,falseifITriState.isFalse()is true, or an exception otherwise!- See Also:
-
getAsBooleanValue
public boolean getAsBooleanValue(boolean bUndefinedValue) Description copied from interface:ITriStateConvert the tri state value into a boolean value, depending on what "undefined" means.- Specified by:
getAsBooleanValuein interfaceITriState- Parameters:
bUndefinedValue- The boolean representation of undefined.- Returns:
trueifITriState.isTrue()is true,falseifITriState.isFalse()is true, or otherwise the passed parameter!- See Also:
-
getAsBooleanObj
Description copied from interface:ITriStateConvert the tri state value into aBooleanvalue, depending on what "undefined" means.- Specified by:
getAsBooleanObjin interfaceITriState- Returns:
Boolean.TRUEifITriState.isTrue()istrue,Boolean.FALSEifITriState.isFalse()istrue, ornull!
-
getAsBooleanObj
Description copied from interface:ITriStateConvert the tri state value into aBooleanvalue, depending on what "undefined" means.- Specified by:
getAsBooleanObjin interfaceITriState- Parameters:
aUndefinedValue- TheBooleanrepresentation of undefined.- Returns:
Boolean.TRUEifITriState.isTrue()is true,Boolean.FALSEifITriState.isFalse()is true, or otherwise the passed parameter!
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
bValue- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
aValue- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
aTriState- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
getFromIDOrNull
-
getFromIDOrUndefined
-
getFromIDOrDefault
-