Build 1.0_r1(from source)

java.lang
Class Boolean

java.lang.Object
  extended by java.lang.Boolean
All Implemented Interfaces:
Serializable, Comparable<Boolean>

public final class Boolean
extends Object
implements Serializable, Comparable<Boolean>

Boolean is the wrapper for the primitive type boolean.

Since:
1.0
See Also:
Serialized Form

Field Summary
static Boolean FALSE
          The instance of the receiver which represents falsehood.
static Boolean TRUE
          The instance of the receiver which represents truth.
static Class<Boolean> TYPE
          The java.lang.Class that represents this class.
 
Constructor Summary
Boolean(boolean value)
          Constructs a new instance of this class given true or false.
Boolean(String string)
          Constructs a new instance of this class given a string.
 
Method Summary
 boolean booleanValue()
          Returns true if the receiver represents true and false if the receiver represents false.
 int compareTo(Boolean that)
           Compares this Boolean to another Boolean.
 boolean equals(Object o)
          Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison.
static boolean getBoolean(String string)
          Returns true if the system property described by the argument equal to "true" using case insensitive comparison, and false otherwise.
 int hashCode()
          Returns an integer hash code for the receiver.
static boolean parseBoolean(String s)
           Parses the string as a boolean.
 String toString()
          Returns a string containing a concise, human-readable description of the receiver.
static String toString(boolean value)
          Converts the specified boolean to its string representation.
static Boolean valueOf(boolean b)
          Returns Boolean.TRUE if the argument is equal to "true" using case insensitive comparison, and Boolean.FALSE representing false otherwise.
static Boolean valueOf(String string)
          Returns a Boolean representing true if the argument is equal to "true" using case insensitive comparison, and a Boolean representing false otherwise.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE

public static final Class<Boolean> TYPE
The java.lang.Class that represents this class.


TRUE

public static final Boolean TRUE
The instance of the receiver which represents truth.


FALSE

public static final Boolean FALSE
The instance of the receiver which represents falsehood.

Constructor Detail

Boolean

public Boolean(String string)
Constructs a new instance of this class given a string. If the string is equal to "true" using a non-case sensitive comparison, the result will be a Boolean representing true, otherwise it will be a Boolean representing false.

Parameters:
string - The name of the desired boolean.

Boolean

public Boolean(boolean value)
Constructs a new instance of this class given true or false.

Parameters:
value - true or false.
Method Detail

booleanValue

public boolean booleanValue()
Returns true if the receiver represents true and false if the receiver represents false.

Returns:
true or false.

equals

public boolean equals(Object o)
Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison.

In this case, the argument must also be a Boolean, and the receiver and argument must represent the same boolean value (i.e. both true or both false).

Overrides:
equals in class Object
Parameters:
o - the object to compare with this object
Returns:
true if the object is the same as this object false if it is different from this object
See Also:
hashCode()

compareTo

public int compareTo(Boolean that)

Compares this Boolean to another Boolean. If this instance has the same value as the instance passed, then 0 is returned. If this instance is true and the instance passed is false, then a positive value is returned. If this instance is false and the instance passed is true, then a negative value is returned.

Specified by:
compareTo in interface Comparable<Boolean>
Parameters:
that - The instance to compare to.
Returns:
int which should be <0 if="" the="" receiver="" should="" sort="" before="" the="" argument,="" 0="" if="" the="" receiver="" should="" sort="" in="" the="" same="" position="" as="" the="" argument,="" and="">0 if the receiver should sort after the argument.
Throws:
NullPointerException - if that is null.
Since:
1.5
See Also:
Comparable

hashCode

public int hashCode()
Returns an integer hash code for the receiver. Any two objects which answer true when passed to equals must answer the same value for this method.

Overrides:
hashCode in class Object
Returns:
the receiver's hash
See Also:
equals(java.lang.Object)

toString

public String toString()
Returns a string containing a concise, human-readable description of the receiver.

Overrides:
toString in class Object
Returns:
a printable representation for the receiver.

getBoolean

public static boolean getBoolean(String string)
Returns true if the system property described by the argument equal to "true" using case insensitive comparison, and false otherwise.

Parameters:
string - The name of the desired boolean.
Returns:
The boolean value.

parseBoolean

public static boolean parseBoolean(String s)

Parses the string as a boolean. If the string is not null and is equal to "true", regardless case, then true is returned, otherwise false.

Parameters:
s - The string to parse.
Returns:
A boolean value.
Since:
1.5

toString

public static String toString(boolean value)
Converts the specified boolean to its string representation. When the boolean is true answer "true", otherwise answer "false".

Parameters:
value - the boolean
Returns:
the boolean converted to a string

valueOf

public static Boolean valueOf(String string)
Returns a Boolean representing true if the argument is equal to "true" using case insensitive comparison, and a Boolean representing false otherwise.

Parameters:
string - The name of the desired boolean.
Returns:
the boolean value.

valueOf

public static Boolean valueOf(boolean b)
Returns Boolean.TRUE if the argument is equal to "true" using case insensitive comparison, and Boolean.FALSE representing false otherwise.

Parameters:
b - the boolean value.
Returns:
Boolean.TRUE or Boolean.FALSE Global true/false objects.

Build 1.0_r1(from source)

Please submit a feedback, bug or feature