This commit is contained in:
@ -23,14 +23,15 @@ public enum OptionState {
|
||||
/**
|
||||
* Gets the boolean value of the given option state if it's boolean compatible
|
||||
*
|
||||
* @param optionState <p>The option state to get the boolean from</p>
|
||||
* @return <p>The boolean value, or an illegal argument exception if called on DEFAULT</p>
|
||||
* @param optionState <p>The option state to get the boolean from</p>
|
||||
* @param defaultValue <p>The default value to use if the option state is DEFAULT</p>
|
||||
* @return <p>The boolean value</p>
|
||||
*/
|
||||
public static boolean getBooleanValue(OptionState optionState) {
|
||||
public static boolean getBooleanValue(OptionState optionState, boolean defaultValue) {
|
||||
return switch (optionState) {
|
||||
case TRUE -> true;
|
||||
case FALSE -> false;
|
||||
case DEFAULT -> throw new IllegalArgumentException("No boolean value available for DEFAULT");
|
||||
case DEFAULT -> defaultValue;
|
||||
};
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user