Class Booleans


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

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean booleanValue​(java.lang.Object booleanObject)
      Returns the boolean value of the object, if the object is an instance of Boolean.
      static java.lang.Boolean parseBoolean​(java.lang.String string)
      Parses a string and returns its boolean value.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • booleanValue

        public static final boolean booleanValue​(java.lang.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 java.lang.Boolean parseBoolean​(java.lang.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:
        java.lang.NullPointerException - if the given string is null
        java.lang.IllegalArgumentException - if the string neither "true" nor "false".
        See Also:
        Boolean.parseBoolean(String)