Package org.hibernate.internal.util
Class NullnessHelper
- java.lang.Object
-
- org.hibernate.internal.util.NullnessHelper
-
public class NullnessHelper extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> Tcoalesce(T... values)Operates like SQL coalesce expression, returning the first non-empty valuestatic <T> TcoalesceSuppliedValues(Function<T,Boolean> checker, Supplier<T>... valueSuppliers)Operates like SQL coalesce expression, returning the first non-empty valuestatic <T> TcoalesceSuppliedValues(Supplier<T>... valueSuppliers)Operates like SQL coalesce expression, returning the first non-empty valuestatic <T> Tnullif(T test, Supplier<T> fallbackSupplier)static <T> Tnullif(T test, T fallback)
-
-
-
Method Detail
-
nullif
public static <T> T nullif(T test, T fallback)
-
nullif
public static <T> T nullif(T test, Supplier<T> fallbackSupplier)
-
coalesce
@SafeVarargs public static <T> T coalesce(T... values)
Operates like SQL coalesce expression, returning the first non-empty value- Type Parameters:
T- Generic type of values to coalesce- Parameters:
values- The list of values.- Returns:
- The first non-empty value, or null if all values were empty
-
coalesceSuppliedValues
@SafeVarargs public static <T> T coalesceSuppliedValues(Supplier<T>... valueSuppliers)
Operates like SQL coalesce expression, returning the first non-empty value- Type Parameters:
T- Generic type of values to coalesce- Parameters:
valueSuppliers- List of value Suppliers- Returns:
- The first non-empty value, or null if all values were empty
-
coalesceSuppliedValues
@SafeVarargs public static <T> T coalesceSuppliedValues(Function<T,Boolean> checker, Supplier<T>... valueSuppliers)
Operates like SQL coalesce expression, returning the first non-empty value- Type Parameters:
T- Generic type of values to coalesce- Parameters:
valueSuppliers- List of value Suppliers- Returns:
- The first non-empty value, or null if all values were empty
-
-