Package org.apache.commons.lang3.mutable
Class MutableBoolean
java.lang.Object
org.apache.commons.lang3.mutable.MutableBoolean
- All Implemented Interfaces:
- Serializable,- Comparable<MutableBoolean>,- Mutable<Boolean>
public class MutableBoolean
extends Object
implements Mutable<Boolean>, Serializable, Comparable<MutableBoolean>
A mutable 
boolean wrapper.
 Note that as MutableBoolean does not extend Boolean, it is not treated by String.format as a Boolean parameter.
- Since:
- 2.2
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionConstructs a new MutableBoolean with the default value of false.MutableBoolean(boolean value) Constructs a new MutableBoolean with the specified value.MutableBoolean(Boolean value) Constructs a new MutableBoolean with the specified value.
- 
Method SummaryModifier and TypeMethodDescriptionbooleanReturns the value of this MutableBoolean as a boolean.intcompareTo(MutableBoolean other) Compares this mutable to another in ascending order.booleanCompares this object to the specified object.getValue()Gets the value as a Boolean instance.inthashCode()Returns a suitable hash code for this mutable.booleanisFalse()Checks if the current value isfalse.booleanisTrue()Checks if the current value istrue.voidsetFalse()Sets the value to false.voidsetTrue()Sets the value to true.voidsetValue(boolean value) Sets the value.voidSets the value from any Boolean instance.Gets this mutable as an instance of Boolean.toString()Returns the String value of this mutable.
- 
Constructor Details- 
MutableBooleanpublic MutableBoolean()Constructs a new MutableBoolean with the default value of false.
- 
MutableBooleanConstructs a new MutableBoolean with the specified value.- Parameters:
- value- the initial value to store
 
- 
MutableBooleanConstructs a new MutableBoolean with the specified value.- Parameters:
- value- the initial value to store, not null
- Throws:
- NullPointerException- if the object is null
 
 
- 
- 
Method Details- 
booleanValueReturns the value of this MutableBoolean as a boolean.- Returns:
- the boolean value represented by this object.
 
- 
compareToCompares this mutable to another in ascending order.- Specified by:
- compareToin interface- Comparable<MutableBoolean>
- Parameters:
- other- the other mutable to compare to, not null
- Returns:
- negative if this is less, zero if equal, positive if greater where false is less than true
 
- 
equalsCompares this object to the specified object. The result istrueif and only if the argument is notnulland is anMutableBooleanobject that contains the samebooleanvalue as this object.
- 
getValueGets the value as a Boolean instance.
- 
hashCodeReturns a suitable hash code for this mutable.
- 
isFalseChecks if the current value isfalse.- Returns:
- trueif the current value is- false
- Since:
- 2.5
 
- 
isTrueChecks if the current value istrue.- Returns:
- trueif the current value is- true
- Since:
- 2.5
 
- 
setFalseSets the value to false.- Since:
- 3.3
 
- 
setTrueSets the value to true.- Since:
- 3.3
 
- 
setValueSets the value.- Parameters:
- value- the value to set
 
- 
setValueSets the value from any Boolean instance.- Specified by:
- setValuein interface- Mutable<Boolean>
- Parameters:
- value- the value to set, not null
- Throws:
- NullPointerException- if the object is null
 
- 
toBooleanGets this mutable as an instance of Boolean.- Returns:
- a Boolean instance containing the value from this mutable, never null
- Since:
- 2.5
 
- 
toStringReturns the String value of this mutable.
 
-