Class BooleanParser


  • public class BooleanParser
    extends java.lang.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 Summary

      Constructors 
      Constructor Description
      BooleanParser()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean parseBoolean​(java.lang.String s)
      Returns true if the input string is case insensitive equal to "true" and false if it is case insensitive equal to "false".
      • Methods inherited from class java.lang.Object

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

      • BooleanParser

        public BooleanParser()
    • Method Detail

      • parseBoolean

        public static boolean parseBoolean​(java.lang.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:
        java.lang.IllegalArgumentException - if s is not null but neither "true" or "false"
        java.lang.NullPointerException - if s is null