Package com.globalmentor.java
Class Booleans
java.lang.Object
com.globalmentor.java.Booleans
Utilities for manipulating boolean objects.
- Author:
- Garret Wilson
-
Method Summary
Modifier and TypeMethodDescriptionstatic final boolean
booleanValue
(Object booleanObject) Returns the boolean value of the object, if the object is an instance ofBoolean
.static final Boolean
parseBoolean
(String string) Parses a string and returns its boolean value.
-
Method Details
-
booleanValue
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
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:
NullPointerException
- if the given string isnull
IllegalArgumentException
- if the string neither "true" nor "false".- See Also:
-