Add static Tristate#toTristate method
This commit is contained in:
parent
45f02bdd5a
commit
a9cfc8c810
1 changed files with 12 additions and 0 deletions
|
@ -20,6 +20,7 @@
|
||||||
package de.staropensource.sosengine.base.type;
|
package de.staropensource.sosengine.base.type;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.exception.TristateConversionException;
|
import de.staropensource.sosengine.base.exception.TristateConversionException;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Just a {@link Boolean}, but it can be {@link #UNSET}.
|
* Just a {@link Boolean}, but it can be {@link #UNSET}.
|
||||||
|
@ -48,6 +49,17 @@ public enum Tristate {
|
||||||
*/
|
*/
|
||||||
FALSE;
|
FALSE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts the {@link Boolean} into a {@link Tristate}.
|
||||||
|
*
|
||||||
|
* @return tristated boolean
|
||||||
|
* @since v1-alpha5
|
||||||
|
*/
|
||||||
|
public static @NotNull Tristate toTristate(boolean bool) {
|
||||||
|
if (bool) return Tristate.TRUE;
|
||||||
|
else return Tristate.FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts the {@link Tristate} into a {@link Boolean}.
|
* Converts the {@link Tristate} into a {@link Boolean}.
|
||||||
* Make sure to check for {@link #UNSET} first.
|
* Make sure to check for {@link #UNSET} first.
|
||||||
|
|
Loading…
Reference in a new issue