Class Boolean


  • public class Boolean
    extends java.lang.Object
    This class converts a boolean property specification (string) in various representations into a booelan value. It is liberal in the representation it accepts, but strict in what it produces.

    Version:
    $Revision$
    Author:
    Gaurang Mehta, Karan Vahi, Jens-S. Vöckler
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String FALSE
      The character representation of a false value.
      static java.lang.String TRUE
      The character representation of a true value.
    • Constructor Summary

      Constructors 
      Constructor Description
      Boolean()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean parse​(java.lang.String rep)
      Converts a boolean string representation into a boolean value.
      static boolean parse​(java.lang.String rep, boolean deflt)
      Converts a boolean string representation into a boolean value.
      static java.lang.String print​(boolean val)
      Converts a boolean value into a strict representation of it.
      • Methods inherited from class java.lang.Object

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

      • TRUE

        public static final java.lang.String TRUE
        The character representation of a true value.
        See Also:
        Constant Field Values
      • FALSE

        public static final java.lang.String FALSE
        The character representation of a false value.
        See Also:
        Constant Field Values
    • Constructor Detail

      • Boolean

        public Boolean()
    • Method Detail

      • print

        public static java.lang.String print​(boolean val)
        Converts a boolean value into a strict representation of it.
        Parameters:
        val - is the boolean input value
        Returns:
        a string representing the boolean value.
      • parse

        public static boolean parse​(java.lang.String rep)
        Converts a boolean string representation into a boolean value. Representations may include non-negative integers, where only 0 means false. Other valid string representations of true include:
         true
         yes
         on
         
        Any other string representation is taken to mean false
        Parameters:
        rep - is the input string representing a boolean value.
        Returns:
        a boolean value from the representation.
      • parse

        public static boolean parse​(java.lang.String rep,
                                    boolean deflt)
        Converts a boolean string representation into a boolean value. Representations may include non-negative integers, where only 0 means false. Other valid string representations of true include:
         true
         yes
         on
         
        Other valid string representations of false include, besides the numerical zero:
         false
         no
         off
         
        Any other string representation is taken to mean the boolean value indicated by the paramater deflt.
        Parameters:
        rep - is the input string representing a boolean value.
        deflt - is the deflt value to use in case rep does not represent a valid boolean value.
        Returns:
        a boolean value from the representation.