com.wm.data
Class MBoolean

java.lang.Object
  extended by com.wm.data.MBoolean
All Implemented Interfaces:
java.io.Serializable

public class MBoolean
extends java.lang.Object
implements java.io.Serializable

This class is a wrapper for boolean values and is similar to the existing Java wrapper class Boolean. However, unlike the Boolean class, MBoolean is mutable, which allows you to change the boolean value that it wraps.

See Also:
MByte, MDouble, MFloat, MInteger, MLong, MShort, Serialized Form

Field Summary
static MBoolean FALSE
          The MBoolean field that corresponds to the primitive boolean value false.
static MBoolean TRUE
          The MBoolean field that corresponds to the primitive boolean value true.
 
Constructor Summary
MBoolean(boolean value)
          Constructs an MBoolean object and sets it to the specified boolean value.
MBoolean(java.lang.String s)
          Constructs an MBoolean object and sets it according to the value specified in the String parameter, s.
 
Method Summary
 boolean booleanValue()
          Returns the value of this MBoolean object as a boolean primitive.
 boolean equals(java.lang.Object obj)
          Compares this MBoolean object with another specified object and returns true if both objects have the same boolean value.
static boolean getBoolean(java.lang.String name)
          Checks the value of the specified system property and returns true if that property contains the string "true".
 boolean getValue()
          Returns this MBoolean object's value as a boolean.
 void setValue(boolean b)
          Sets this MBoolean object's value to the specified boolean value.
 java.lang.String toString()
          Returns a String representation of this MBoolean object's boolean value.
static MBoolean valueOf(java.lang.String s)
          Returns an MBoolean object set according to the value of the String parameter s.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TRUE

public static final MBoolean TRUE
The MBoolean field that corresponds to the primitive boolean value true.


FALSE

public static final MBoolean FALSE
The MBoolean field that corresponds to the primitive boolean value false.

Constructor Detail

MBoolean

public MBoolean(boolean value)
Constructs an MBoolean object and sets it to the specified boolean value.

Parameters:
value - The boolean value to which you want this MBoolean object set.

MBoolean

public MBoolean(java.lang.String s)
Constructs an MBoolean object and sets it according to the value specified in the String parameter, s.

Parameters:
s - A String that specifies whether the MBoolean object will be set to true or false as follows.
  • If s is set to "true" (in any combination of upper- or lower-case letters), the MBoolean object is set to the boolean value, true.
  • If s is set null or contains any combination of characters other than "true", the MBoolean object is set to false.

Examples:
new MBoolean("True") constructs an MBoolean object representing the boolean value true.

new MBoolean("hack") constructs an MBoolean object representing the boolean value false.

Method Detail

booleanValue

public boolean booleanValue()
Returns the value of this MBoolean object as a boolean primitive.

Returns:
The primitive boolean value of this object.

valueOf

public static MBoolean valueOf(java.lang.String s)
Returns an MBoolean object set according to the value of the String parameter s.

Parameters:
s - A String that specifies whether the returned MBoolean object will be set to true or false as follows.
  • If s is set to "true" (in any combination of upper or lower-case letters), the MBoolean object is set to the boolean value, true.
  • If s is set null or contains any combination of characters other than "true", the MBoolean object is set to false.

Examples:
MBoolean.valueOf("True") returns an MBoolean object representing the boolean value true.

MBoolean.valueOf("hack") returns an MBoolean object representing the boolean value false.

Returns:
A MBoolean object that is set to the specified boolean value.

toString

public java.lang.String toString()
Returns a String representation of this MBoolean object's boolean value.

Overrides:
toString in class java.lang.Object
Returns:
A String with the value "true" if this object's value is true or "false" is the object's value is false.

equals

public boolean equals(java.lang.Object obj)
Compares this MBoolean object with another specified object and returns true if both objects have the same boolean value.

Overrides:
equals in class java.lang.Object
Parameters:
obj - The Object to which this MBoolean will be compared.
Returns:
The boolean value true if the two objects have the same boolean value; false otherwise.

getBoolean

public static boolean getBoolean(java.lang.String name)
Checks the value of the specified system property and returns true if that property contains the string "true".

Note: System properties are accessed through getProperty, a method defined in the System class.

Parameters:
name - A String that specifies the name of the system property that is to be checked.
Returns:
The boolean value true if the specified property contains the string "true". Returns false in all other cases, including cases when the specified property does not exist or is null.

setValue

public void setValue(boolean b)
Sets this MBoolean object's value to the specified boolean value.

Parameters:
b - A boolean specifying the value to which this MBoolean object is to be set.

getValue

public boolean getValue()
Returns this MBoolean object's value as a boolean.

Returns:
A boolean that is set to the value of this MBoolean object.