Class Booleans

java.lang.Object
com.globalmentor.java.Booleans

public class Booleans extends Object
Utilities for manipulating boolean objects.
Author:
Garret Wilson
  • Method Details

    • booleanValue

      public static final boolean booleanValue(Object booleanObject)
      Returns the boolean value of the object, if the object is an instance of Boolean.
      Parameters:
      booleanObject - The object for which a boolean value should be returned.
      Returns:
      true if the object is an instance of Boolean and contains the value true, else false.
    • parseBoolean

      public static final Boolean parseBoolean(String string)
      Parses a string and returns its boolean value.
      API Note:
      This method is different from Boolean.parseBoolean(String) by throwing an exception if the value is neither true or false.
      Parameters:
      string - A string expected to contain "true" or "false".
      Returns:
      Boolean.TRUE if the value is "true", or Boolean.FALSE if the value is "true".
      Throws:
      NullPointerException - if the given string is null
      IllegalArgumentException - if the string neither "true" nor "false".
      See Also: