Package com.globalmentor.java
Class Booleans
- java.lang.Object
-
- com.globalmentor.java.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 ofBoolean
.static java.lang.Boolean
parseBoolean(java.lang.String string)
Parses a string and returns its boolean value.
-
-
-
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 ofBoolean
.- Parameters:
booleanObject
- The object for which a boolean value should be returned.- Returns:
true
if the object is an instance ofBoolean
and contains the valuetrue
, elsefalse
.
-
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 neithertrue
orfalse
. - Parameters:
string
- A string expected to contain "true" or "false".- Returns:
Boolean.TRUE
if the value is "true", orBoolean.FALSE
if the value is "true".- Throws:
java.lang.NullPointerException
- if the given string isnull
java.lang.IllegalArgumentException
- if the string neither "true" nor "false".- See Also:
Boolean.parseBoolean(String)
-
-