org.pf.util
Class Bool

java.lang.Object
  extended by org.pf.util.Bool

public class Bool
extends java.lang.Object

Utility class for missing convenience with Boolean and boolean.

Version:
1.0
Author:
Manfred Duchrow

Method Summary
 java.lang.Boolean asBoolean()
          Returns the Boolean value of the receiver.
 boolean booleanValue()
          Returns the boolean value of the receiver
 boolean equals(Bool bool)
          Returns whether the given Bool object is equal to the receiver.
 boolean equals(boolean bool)
          Returns whether the given boolean value is equal to the receiver.
 boolean equals(java.lang.Boolean bool)
          Returns whether the given Boolean object is equal to the receiver.
 boolean equals(java.lang.Object obj)
          Returns whether the given object is equal to the receiver.
static Bool get(boolean bool)
          Returns the Bool instance corresponding to the given boolean value.
static Bool get(java.lang.Boolean bool)
          Returns the Bool instance corresponding to the given Boolean value.
static Bool get(java.lang.String boolStr)
          Returns the Bool instance corresponding to the given String value.
static Bool getFalse()
          Returns the Bool instance that represents the true value.
static Bool getTrue()
          Returns the Bool instance that represents the true value.
 int hashCode()
          Returns a hash code of the Bool object.
 boolean isFalse()
          Returns true if the receiver is a representation of false.
static boolean isFalse(java.lang.Object anObject)
          Returns true, if the given object is a sort of boolean "false" representation otherwise false.
 boolean isTrue()
          Returns true if the receiver is a representation of true.
static boolean isTrue(java.lang.Object anObject)
          Returns true, if the given object is a sort of boolean "true" representation otherwise false.
 Bool not()
          Returns the opposite value of the receiver.
static java.lang.Boolean toBoolean(boolean flag)
          Returns the Boolean object Boolean.FALSE or Boolean.TRUE that corresponds to the given boolean flag.
 java.lang.String toString()
          Returns the string representation of the receiver, which is either "true" or "false".
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

getTrue

public static Bool getTrue()
Returns the Bool instance that represents the true value.


getFalse

public static Bool getFalse()
Returns the Bool instance that represents the true value.


isTrue

public static boolean isTrue(java.lang.Object anObject)
Returns true, if the given object is a sort of boolean "true" representation otherwise false.
Objects recognized as true are:
Boolean.TRUE, "true", "on", "yes", "1"


isFalse

public static boolean isFalse(java.lang.Object anObject)
Returns true, if the given object is a sort of boolean "false" representation otherwise false.
Objects recognized as true see isTrue(). All others are treated as a false representation.


get

public static Bool get(boolean bool)
Returns the Bool instance corresponding to the given boolean value.


get

public static Bool get(java.lang.Boolean bool)
Returns the Bool instance corresponding to the given Boolean value.


get

public static Bool get(java.lang.String boolStr)
Returns the Bool instance corresponding to the given String value.
The values "true", "on", "yes" and "1" return the true instance. All other values return the false instance.


toBoolean

public static java.lang.Boolean toBoolean(boolean flag)
Returns the Boolean object Boolean.FALSE or Boolean.TRUE that corresponds to the given boolean flag.


isTrue

public boolean isTrue()
Returns true if the receiver is a representation of true.


isFalse

public boolean isFalse()
Returns true if the receiver is a representation of false.


not

public Bool not()
Returns the opposite value of the receiver.


asBoolean

public java.lang.Boolean asBoolean()
Returns the Boolean value of the receiver.


booleanValue

public boolean booleanValue()
Returns the boolean value of the receiver


equals

public boolean equals(boolean bool)
Returns whether the given boolean value is equal to the receiver.


equals

public boolean equals(java.lang.Boolean bool)
Returns whether the given Boolean object is equal to the receiver.


equals

public boolean equals(Bool bool)
Returns whether the given Bool object is equal to the receiver.


equals

public boolean equals(java.lang.Object obj)
Returns whether the given object is equal to the receiver. This one returns alsways false, because there are separate methods for the only three types that can be equal ( boolean, Boolean, Bool ).

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Returns a hash code of the Bool object.
The values are the same as in Boolean

Overrides:
hashCode in class java.lang.Object
Returns:
The integer 1231 if this object represents true; returns the integer 1237 if this object represents false.
See Also:
Boolean.hashCode()

toString

public java.lang.String toString()
Returns the string representation of the receiver, which is either "true" or "false".

Overrides:
toString in class java.lang.Object