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 boolean
areAllNonNull(Object... objects)
static boolean
areSameNullness(Object... values)
Ensures that either: all values are null all values are non-nullstatic <T> T
coalesce(T... values)
Operates like SQL coalesce expression, returning the first non-empty valuestatic <T> T
coalesceSuppliedValues(Function<T,Boolean> checker, Supplier<T>... valueSuppliers)
Operates like SQL coalesce expression, returning the first non-empty valuestatic <T> T
coalesceSuppliedValues(Supplier<T>... valueSuppliers)
Operates like SQL coalesce expression, returning the first non-empty valuestatic <T> T
nullif(T test, Supplier<T> fallbackSupplier)
static <T> T
nullif(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
-
areSameNullness
public static boolean areSameNullness(Object... values)
Ensures that either:- all values are null
- all values are non-null
-
areAllNonNull
public static boolean areAllNonNull(Object... objects)
-
-