public class ObjectsHelper
extends java.lang.Object
Objects
that help check for null and
other constraints.Constructor | Description |
---|---|
ObjectsHelper() |
Modifier and Type | Method | Description |
---|---|---|
static int |
checkClosedRange(int val,
int min,
int max,
java.lang.String valName) |
|
static long |
checkClosedRange(long val,
long min,
long max,
java.lang.String valName) |
|
static java.lang.Integer |
checkClosedRangeAllowNull(java.lang.Integer val,
int min,
int max,
java.lang.String valName) |
|
static java.lang.IllegalArgumentException |
createIllegalArgumentException(int val,
int min,
int max,
java.lang.String valName) |
|
static java.lang.IllegalArgumentException |
createIllegalArgumentException(long val,
long min,
long max,
java.lang.String valName) |
|
static void |
requireNonNullAndNonNegative(java.time.Duration duration) |
|
static boolean |
requireNonNullElse(java.lang.Boolean val,
boolean defaultVal) |
|
static double |
requireNonNullElse(java.lang.Double val,
double defaultVal) |
|
static int |
requireNonNullElse(java.lang.Integer val,
int defaultVal) |
|
static <T> T |
requireNonNullElse(T obj,
T defaultObj) |
|
static <T> T |
requireNonNullElseGet(T obj,
java.util.function.Supplier<? extends T> defaultObjSupplier) |
|
static <T> T |
requireNonNullWithName(T obj,
java.lang.String varName) |
|
static <E extends java.lang.Enum<E>> |
requireSubsetOf(java.util.Set<E> subset,
java.util.Set<E> set,
java.lang.String errorMessage) |
|
static <E extends java.lang.Enum<E>> |
requireSubsetOf(java.util.Set<E> subset,
java.util.Set<E> set,
java.util.function.Supplier<java.lang.String> messageSupplier) |
|
static <E extends java.lang.Enum<E>> |
requireSubsetOfAllowNull(java.util.Set<E> subset,
java.util.Set<E> set,
java.lang.String errorMessage) |
|
static <E extends java.lang.Enum<E>> |
requireSubsetOfAllowNull(java.util.Set<E> subset,
java.util.Set<E> set,
java.util.function.Supplier<java.lang.String> messageSupplier) |
public static double requireNonNullElse(java.lang.Double val, double defaultVal)
public static int requireNonNullElse(java.lang.Integer val, int defaultVal)
public static boolean requireNonNullElse(java.lang.Boolean val, boolean defaultVal)
public static <T> T requireNonNullElse(T obj, T defaultObj)
public static <T> T requireNonNullElseGet(T obj, java.util.function.Supplier<? extends T> defaultObjSupplier)
public static <T> T requireNonNullWithName(T obj, java.lang.String varName)
public static void requireNonNullAndNonNegative(java.time.Duration duration)
public static int checkClosedRange(int val, int min, int max, java.lang.String valName)
public static long checkClosedRange(long val, long min, long max, java.lang.String valName)
public static java.lang.Integer checkClosedRangeAllowNull(java.lang.Integer val, int min, int max, java.lang.String valName)
public static java.lang.IllegalArgumentException createIllegalArgumentException(long val, long min, long max, java.lang.String valName)
public static java.lang.IllegalArgumentException createIllegalArgumentException(int val, int min, int max, java.lang.String valName)
public static <E extends java.lang.Enum<E>> java.util.Set<E> requireSubsetOf(java.util.Set<E> subset, java.util.Set<E> set, java.lang.String errorMessage)
public static <E extends java.lang.Enum<E>> java.util.Set<E> requireSubsetOf(java.util.Set<E> subset, java.util.Set<E> set, java.util.function.Supplier<java.lang.String> messageSupplier)
public static <E extends java.lang.Enum<E>> java.util.Set<E> requireSubsetOfAllowNull(java.util.Set<E> subset, java.util.Set<E> set, java.lang.String errorMessage)
public static <E extends java.lang.Enum<E>> java.util.Set<E> requireSubsetOfAllowNull(java.util.Set<E> subset, java.util.Set<E> set, java.util.function.Supplier<java.lang.String> messageSupplier)