Class BooleanUtils

java.lang.Object
org.litebridge.commons.BooleanUtils

public final class BooleanUtils extends Object
Utility class for boolean operations.
  • Method Details

    • toBoolean

      public static boolean toBoolean(@Nullable Boolean value)
      Converts a Boolean object to a primitive boolean.
      Parameters:
      value - the Boolean object to be converted, which may be null.
      Returns:
      true if the input value is Boolean.TRUE, otherwise false.
    • requireTrue

      public static boolean requireTrue(boolean value, String message)
      Ensures that a given boolean value is true. If the value is false, throws an IllegalArgumentException with the specified message.
      Parameters:
      value - the boolean value to check
      message - the exception message to use if the value is false
      Returns:
      true if the value is true
      Throws:
      IllegalArgumentException - if the value is false
    • requireFalse

      public static boolean requireFalse(boolean value, String message)
      Ensures that a given boolean value is false. If the value is true, throws an IllegalArgumentException with the specified message.
      Parameters:
      value - the boolean value to check
      message - the exception message to use if the value is true
      Returns:
      false if the value is false
      Throws:
      IllegalArgumentException - if the value is true