Enum Tristate

    • Enum Constant Detail

      • TRUE

        public static final Tristate TRUE
      • FALSE

        public static final Tristate FALSE
      • UNDEFINED

        public static final Tristate UNDEFINED
    • Method Detail

      • values

        public static Tristate[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (Tristate c : Tristate.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static Tristate 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
      • fromBoolean

        public static Tristate fromBoolean​(boolean val)
        Returns the appropriate tristate for a given boolean value.
        Parameters:
        val - The boolean value
        Returns:
        The appropriate tristate
      • fromNullableBoolean

        public static Tristate fromNullableBoolean​(@Nullable Boolean val)
        Returns the appropriate tristate for a given nullable boolean value, where null equates to UNDEFINED.
        Parameters:
        val - The nullable boolean value
        Returns:
        The appropriate tristate
      • and

        public abstract Tristate and​(Tristate other)
        ANDs this tristate with another tristate.
        Parameters:
        other - The tristate to AND with
        Returns:
        The result
      • or

        public abstract Tristate or​(Tristate other)
        ORs this tristate with another tristate.
        Parameters:
        other - The tristate to OR with
        Returns:
        The result
      • not

        public abstract Tristate not()
        Negates this tristate.
        Returns:
        The result
      • asBoolean

        public boolean asBoolean()
        Returns the boolean representation of this tristate.
        Returns:
        The boolean tristate representation
      • asNullableBoolean

        public @Nullable Boolean asNullableBoolean()
        Returns the nullable boolean representation of this tristate, where UNDEFINED equates to null.

        Note: To ensure that there is a one-to-one mapping of nullable booleans to and from Tristate, this method will return null rather than use an Optional.

        Returns:
        The nullable boolean tristate representation