Package org.hibernate.internal.util
Class NullnessHelper
java.lang.Object
org.hibernate.internal.util.NullnessHelper
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanareAllNonNull(Object... objects) static booleanareSameNullness(Object... values) Ensures that either: all values are null all values are non-nullstatic <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> Tstatic <T> Tnullif(T test, T fallback)
-
Method Details
-
nullif
public static <T> T nullif(T test, T fallback) -
nullif
-
coalesce
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
- Implementation Note:
- This impl treats empty strings (`""`) as null.
-
coalesceSuppliedValues
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
- Implementation Note:
- This impl treats empty strings (`""`) as null.
-
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
- Implementation Note:
- This impl treats empty strings (`""`) as null.
-
areSameNullness
Ensures that either:- all values are null
- all values are non-null
-
areAllNonNull
-