Class BooleanParser


  • public class BooleanParser
    extends Object
    Utility class parsing a string into a boolean. In contrast to Boolean.parseBoolean in the Java API this parser is strict.
    Author:
    bratseth
    • Constructor Detail

      • BooleanParser

        public BooleanParser()
    • Method Detail

      • parseBoolean

        public static boolean parseBoolean​(String s)
        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