package net.knarcraft.ffmpegconverter.utility; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.List; /** * A helper class for dealing with configuration value types */ public final class ConfigHelper { private ConfigHelper() { } /** * Gets the given value as a string list * * @param value
The raw string list value
* @returnThe value as a string list, or null if not compatible
*/ public static @NotNull ListThis will throw an exception if used for a non-boolean value
* * @param valueThe object value to get
* @returnThe value of the given object as a boolean
* @throws ClassCastExceptionIf the given value is not a boolean
*/ public static boolean asBoolean(@Nullable Object value) throws ClassCastException { if (value instanceof Boolean booleanValue) { return booleanValue; } else if (value instanceof String) { return Boolean.parseBoolean((String) value); } else { throw new ClassCastException(); } } }