Package com.yahoo.text
Class BooleanParser
java.lang.Object
com.yahoo.text.BooleanParser
Utility class parsing a string into a boolean.
In contrast to Boolean.parseBoolean in the Java API this parser is strict.
- Author:
- bratseth
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
Returns true if the input string is case insensitive equal to "true" and false if it is case insensitive equal to "false".
-
Constructor Details
-
BooleanParser
public BooleanParser()
-
-
Method Details
-
parseBoolean
Returns true if the input string is case insensitive equal to "true" and false if it is case insensitive equal to "false". In any other case an exception is thrown.- Parameters:
s
- the string to parse- Returns:
- true if s is "true", false if it is "false"
- Throws:
IllegalArgumentException
- if s is not null but neither "true" or "false"NullPointerException
- if s is null
-