Enum ETriState

java.lang.Object
java.lang.Enum<ETriState>
com.helger.commons.state.ETriState
All Implemented Interfaces:
IHasID<String>, ITriState, Serializable, Comparable<ETriState>, java.lang.constant.Constable

public enum ETriState extends Enum<ETriState> implements IHasID<String>, ITriState
Represents an object that has one of 3 different states compared to a boolean that has only 2 different states.
Author:
Philip Helger
  • Enum Constant Details

    • TRUE

      public static final ETriState TRUE
    • FALSE

      public static final ETriState FALSE
    • UNDEFINED

      public static final ETriState UNDEFINED
  • Method Details

    • values

      public static ETriState[] 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

      public static ETriState valueOf(String name)
      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 name
      NullPointerException - if the argument is null
    • getID

      @Nonnull @Nonempty public String getID()
      Description copied from interface: IHasID
      Get the unique ID of this object. If the type is String than the returned value must match an XML NMToken expression (so e.g. no ':' in the ID)!
      Specified by:
      getID in interface IHasID<String>
      Returns:
      The ID of this object. May not be null.
    • isTrue

      public boolean isTrue()
      Specified by:
      isTrue in interface ITriState
      Returns:
      true if the value is true.
    • isFalse

      public boolean isFalse()
      Specified by:
      isFalse in interface ITriState
      Returns:
      true if the value is false
    • isDefined

      public boolean isDefined()
      Specified by:
      isDefined in interface ITriState
      Returns:
      true if the value is not undefined (if it is either true or false)
    • getAsBooleanValue

      public boolean getAsBooleanValue()
      Description copied from interface: ITriState
      Convert the tri state value into a boolean value. If it is undefined, an IllegalStateException is thrown.
      Specified by:
      getAsBooleanValue in interface ITriState
      Returns:
      true if ITriState.isTrue() is true, false if ITriState.isFalse() is true, or an exception otherwise!
      See Also:
    • getAsBooleanValue

      public boolean getAsBooleanValue(boolean bUndefinedValue)
      Description copied from interface: ITriState
      Convert the tri state value into a boolean value, depending on what "undefined" means.
      Specified by:
      getAsBooleanValue in interface ITriState
      Parameters:
      bUndefinedValue - The boolean representation of undefined.
      Returns:
      true if ITriState.isTrue() is true, false if ITriState.isFalse() is true, or otherwise the passed parameter!
      See Also:
    • getAsBooleanObj

      @Nullable public Boolean getAsBooleanObj()
      Description copied from interface: ITriState
      Convert the tri state value into a Boolean value, depending on what "undefined" means.
      Specified by:
      getAsBooleanObj in interface ITriState
      Returns:
      Boolean.TRUE if ITriState.isTrue() is true, Boolean.FALSE if ITriState.isFalse() is true, or null!
    • getAsBooleanObj

      @Nullable public Boolean getAsBooleanObj(@Nullable Boolean aUndefinedValue)
      Description copied from interface: ITriState
      Convert the tri state value into a Boolean value, depending on what "undefined" means.
      Specified by:
      getAsBooleanObj in interface ITriState
      Parameters:
      aUndefinedValue - The Boolean representation of undefined.
      Returns:
      Boolean.TRUE if ITriState.isTrue() is true, Boolean.FALSE if ITriState.isFalse() is true, or otherwise the passed parameter!
    • valueOf

      @Nonnull public static ETriState valueOf(boolean bValue)
      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 name
      NullPointerException - if the argument is null
    • valueOf

      @Nonnull public static ETriState valueOf(@Nullable Boolean aValue)
      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 name
      NullPointerException - if the argument is null
    • valueOf

      @Nonnull public static ETriState valueOf(@Nonnull ITriState aTriState)
      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 name
      NullPointerException - if the argument is null
    • getFromIDOrNull

      @Nullable public static ETriState getFromIDOrNull(@Nullable String sID)
    • getFromIDOrUndefined

      @Nonnull public static ETriState getFromIDOrUndefined(@Nullable String sID)
    • getFromIDOrDefault

      @Nullable public static ETriState getFromIDOrDefault(@Nullable String sID, @Nullable ETriState eDefault)