public final class ObjectUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static int |
checkInRange(int i,
int start,
int end,
String name)
Checks that the given argument is in range.
|
static long |
checkInRange(long l,
long start,
long end,
String name)
Checks that the given argument is in range.
|
static byte[] |
checkNonEmpty(byte[] array,
String name)
Checks that the given argument is neither null nor empty.
|
static char[] |
checkNonEmpty(char[] array,
String name)
Checks that the given argument is neither null nor empty.
|
static CharSequence |
checkNonEmpty(CharSequence value,
String name)
Checks that the given argument is neither null nor empty.
|
static String |
checkNonEmpty(String value,
String name)
Checks that the given argument is neither null nor empty.
|
static <T> T[] |
checkNonEmpty(T[] array,
String name)
Checks that the given argument is neither null nor empty.
|
static <K,V,T extends Map<K,V>> |
checkNonEmpty(T value,
String name)
Checks that the given argument is neither null nor empty.
|
static <T extends Collection<?>> |
checkNonEmpty(T collection,
String name)
Checks that the given argument is neither null nor empty.
|
static String |
checkNonEmptyAfterTrim(String value,
String name)
Trims the given argument and checks whether it is neither null nor empty.
|
static <T> T |
checkNotNull(T arg,
String text)
Checks that the given argument is not null.
|
static <T> T |
checkNotNullArrayParam(T value,
int index,
String name)
Checks that the given argument is not null.
|
static <T> T |
checkNotNullWithIAE(T arg,
String paramName)
Checks that the given argument is not null.
|
static double |
checkPositive(double d,
String name)
Checks that the given argument is strictly positive.
|
static float |
checkPositive(float f,
String name)
Checks that the given argument is strictly positive.
|
static int |
checkPositive(int i,
String name)
Checks that the given argument is strictly positive.
|
static long |
checkPositive(long l,
String name)
Checks that the given argument is strictly positive.
|
static double |
checkPositiveOrZero(double d,
String name)
Checks that the given argument is positive or zero.
|
static float |
checkPositiveOrZero(float f,
String name)
Checks that the given argument is positive or zero.
|
static int |
checkPositiveOrZero(int i,
String name)
Checks that the given argument is positive or zero.
|
static long |
checkPositiveOrZero(long l,
String name)
Checks that the given argument is positive or zero.
|
static <T> T[] |
deepCheckNotNull(String text,
T... varargs)
Check that the given varargs is not null and does not contain elements
null elements.
|
static int |
intValue(Integer wrapper,
int defaultValue)
Resolves a possibly null Integer to a primitive int, using a default value.
|
static long |
longValue(Long wrapper,
long defaultValue)
Resolves a possibly null Long to a primitive long, using a default value.
|
public static <T> T checkNotNull(T arg,
String text)
NullPointerException.
Otherwise, returns the argument.public static <T> T[] deepCheckNotNull(String text, T... varargs)
NullPointerException.
Otherwise, returns the argument.public static <T> T checkNotNullWithIAE(T arg,
String paramName)
throws IllegalArgumentException
IllegalArgumentException.
Otherwise, returns the argument.IllegalArgumentExceptionpublic static <T> T checkNotNullArrayParam(T value,
int index,
String name)
throws IllegalArgumentException
IllegalArgumentException.
Otherwise, returns the argument.T - type of the given argument value.name - of the parameter, belongs to the exception message.index - of the array, belongs to the exception message.value - to check.IllegalArgumentException - if value is null.public static int checkPositive(int i,
String name)
IllegalArgumentException.
Otherwise, returns the argument.public static long checkPositive(long l,
String name)
IllegalArgumentException.
Otherwise, returns the argument.public static double checkPositive(double d,
String name)
IllegalArgumentException.
Otherwise, returns the argument.public static float checkPositive(float f,
String name)
IllegalArgumentException.
Otherwise, returns the argument.public static int checkPositiveOrZero(int i,
String name)
IllegalArgumentException.
Otherwise, returns the argument.public static long checkPositiveOrZero(long l,
String name)
IllegalArgumentException.
Otherwise, returns the argument.public static double checkPositiveOrZero(double d,
String name)
IllegalArgumentException.
Otherwise, returns the argument.public static float checkPositiveOrZero(float f,
String name)
IllegalArgumentException.
Otherwise, returns the argument.public static int checkInRange(int i,
int start,
int end,
String name)
IllegalArgumentException.
Otherwise, returns the argument.public static long checkInRange(long l,
long start,
long end,
String name)
IllegalArgumentException.
Otherwise, returns the argument.public static <T> T[] checkNonEmpty(T[] array,
String name)
NullPointerException or IllegalArgumentException.
Otherwise, returns the argument.public static byte[] checkNonEmpty(byte[] array,
String name)
NullPointerException or IllegalArgumentException.
Otherwise, returns the argument.public static char[] checkNonEmpty(char[] array,
String name)
NullPointerException or IllegalArgumentException.
Otherwise, returns the argument.public static <T extends Collection<?>> T checkNonEmpty(T collection, String name)
NullPointerException or IllegalArgumentException.
Otherwise, returns the argument.public static String checkNonEmpty(String value, String name)
NullPointerException or IllegalArgumentException.
Otherwise, returns the argument.public static <K,V,T extends Map<K,V>> T checkNonEmpty(T value, String name)
NullPointerException or IllegalArgumentException.
Otherwise, returns the argument.public static CharSequence checkNonEmpty(CharSequence value, String name)
NullPointerException or IllegalArgumentException.
Otherwise, returns the argument.public static String checkNonEmptyAfterTrim(String value, String name)
NullPointerException or IllegalArgumentException.
Otherwise, returns the trimmed argument.value - to trim and check.name - of the parameter.NullPointerException - if value is null.IllegalArgumentException - if the trimmed value is empty.public static int intValue(Integer wrapper, int defaultValue)
wrapper - the wrapperdefaultValue - the default valuepublic static long longValue(Long wrapper, long defaultValue)
wrapper - the wrapperdefaultValue - the default valueCopyright © 2008–2025 The Netty Project. All rights reserved.