Package org.apache.juneau.internal
Class Flag
java.lang.Object
org.apache.juneau.internal.Flag
A simple settable boolean value.
- 
Method SummaryModifier and TypeMethodDescriptionstatic Flagcreate()Creates a boolean value initialized tofalse .booleanSets the boolean value totrue and returns the value before it was set.booleanSets the boolean value tofalse and returns the value before it was set.Runs a snippet of code if the boolean value isfalse .Runs a snippet of code if the boolean value istrue .booleanisSet()Returnstrue if the boolean value istrue .booleanisUnset()Returnstrue if the boolean value isfalse .static Flagof(boolean value) Creates a boolean value with the specified initial state.set()Sets the boolean value totrue .setIf(boolean value) Sets the boolean value totrue if the value istrue .unset()Sets the boolean value tofalse .
- 
Method Details- 
createCreates a boolean value initialized tofalse .- Returns:
- A new boolean value.
 
- 
ofCreates a boolean value with the specified initial state.- Parameters:
- value- The initial state of the value.
- Returns:
- A new boolean value.
 
- 
ifSetRuns a snippet of code if the boolean value istrue .Example:BoolValue flag = BoolValue.create (); ...flag .ifSet(()->doSomething ());- Parameters:
- snippet- The snippet of code to run.
- Returns:
- This object.
 
- 
ifNotSetRuns a snippet of code if the boolean value isfalse .Example:BoolValue flag = BoolValue.create (); ...flag .ifNotSet(()->doSomething ());- Parameters:
- snippet- The snippet of code to run.
- Returns:
- This object.
 
- 
getAndSetSets the boolean value totrue and returns the value before it was set.- Returns:
- The previous value.
 
- 
getAndUnsetSets the boolean value tofalse and returns the value before it was set.- Returns:
- The previous value.
 
- 
setSets the boolean value totrue .- Returns:
- This object.
 
- 
unsetSets the boolean value tofalse .- Returns:
- This object.
 
- 
isSetReturnstrue if the boolean value istrue .- Returns:
- true if the boolean value is- true .
 
- 
isUnsetReturnstrue if the boolean value isfalse .- Returns:
- true if the boolean value is- false .
 
- 
setIfSets the boolean value totrue if the value istrue .- Parameters:
- value- The value to set.
- Returns:
- This object.
 
 
-