Package com.helger.base.numeric.mutable
Class MutableBoolean
java.lang.Object
com.helger.base.numeric.mutable.MutableBoolean
- All Implemented Interfaces:
ICloneable<MutableBoolean>,IComparable<MutableBoolean>,IMutableObject<MutableBoolean>,IGenericImplTrait<MutableBoolean>,Comparable<MutableBoolean>
Object wrapper around a boolean so that it can be passed a final object but
is mutable.
- Author:
- Philip Helger
-
Constructor Summary
ConstructorsConstructorDescriptionMutableBoolean(boolean bValue) Initialize with a certain value.MutableBoolean(@NonNull MutableBoolean aValue) Copy constructor.MutableBoolean(@NonNull Boolean aValue) Initialize with a certain value. -
Method Summary
Modifier and TypeMethodDescriptionbooleanintcompareTo(@NonNull MutableBoolean rhs) boolean@NonNull Boolean@NonNull MutableBooleangetClone()<T> @Nullable TIf the current value istrue, get a value from the supplier; otherwise returnnull.<T> @Nullable TIf the current value istrue, get a value from the supplier; otherwise return the default value.inthashCode()protected voidThis method is invoked after a value changed.@NonNull EChangeset(boolean bValue) Set a new value.@NonNull EChangeset(@NonNull MutableBoolean aValue) Set a new value.@NonNull EChangeSet a new value.toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.helger.base.compare.IComparable
isEQ, isGE, isGT, isLE, isLT, isNEMethods inherited from interface com.helger.base.trait.IGenericImplTrait
thisAsT
-
Constructor Details
-
MutableBoolean
public MutableBoolean(boolean bValue) Initialize with a certain value.- Parameters:
bValue- The value to be used.
-
MutableBoolean
Initialize with a certain value.- Parameters:
aValue- The value to be used. May not benull.
-
MutableBoolean
Copy constructor.- Parameters:
aValue- The object to copy from. May not benull.
-
-
Method Details
-
onAfterChange
@OverrideOnDemand protected void onAfterChange()This method is invoked after a value changed. -
booleanValue
public boolean booleanValue()- Returns:
- The current boolean value.
-
getAsBoolean
- Returns:
- The current value as a
Booleanobject. Nevernull.
-
set
Set a new value.- Parameters:
aValue- The new value to set. May not benull.- Returns:
EChange.CHANGEDif the value was changed.
-
set
Set a new value.- Parameters:
aValue- The new value to set. May not benull.- Returns:
EChange.CHANGEDif the value was changed.
-
set
Set a new value.- Parameters:
bValue- The new value to set.- Returns:
EChange.CHANGEDif the value was changed.
-
getIf
If the current value istrue, get a value from the supplier; otherwise returnnull.- Type Parameters:
T- The return type.- Parameters:
aSupplier- The supplier to use. May not benull.- Returns:
- The supplied value or
null.
-
getIf
If the current value istrue, get a value from the supplier; otherwise return the default value.- Type Parameters:
T- The return type.- Parameters:
aSupplier- The supplier to use. May not benull.aDefault- The default value to return if the current value isfalse. May benull.- Returns:
- The supplied value or the default value.
-
compareTo
- Specified by:
compareToin interfaceComparable<MutableBoolean>
-
getClone
- Specified by:
getClonein interfaceICloneable<MutableBoolean>- Returns:
- A 100% deep-copy of the implementing class.
-
equals
-
hashCode
public int hashCode() -
toString
-