diff --git a/base/src/main/java/de/staropensource/sosengine/base/type/Tristate.java b/base/src/main/java/de/staropensource/sosengine/base/type/Tristate.java index bb936dd5..e7862ace 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/type/Tristate.java +++ b/base/src/main/java/de/staropensource/sosengine/base/type/Tristate.java @@ -20,6 +20,7 @@ package de.staropensource.sosengine.base.type; import de.staropensource.sosengine.base.exception.TristateConversionException; +import org.jetbrains.annotations.NotNull; /** * Just a {@link Boolean}, but it can be {@link #UNSET}. @@ -48,6 +49,17 @@ public enum Tristate { */ 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}. * Make sure to check for {@link #UNSET} first.