public final class ObjectUtil extends Object
Modifier and Type | Method and Description |
---|---|
static <T> T[] |
checkNonEmpty(T[] array,
String name)
Checks that the given argument is neither null nor empty.
|
static <T> T |
checkNotNull(T arg,
String text)
Checks that the given argument is not null.
|
static int |
checkPositive(int i,
String name)
Checks that the given argument is strictly positive.
|
static long |
checkPositive(long i,
String name)
Checks that the given argument is strictly positive.
|
static int |
checkPositiveOrZero(int i,
String name)
Checks that the given argument is positive or zero.
|
static long |
checkPositiveOrZero(long i,
String name)
Checks that the given argument is positive or zero.
|
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 int checkPositive(int i, String name)
IllegalArgumentException
.
Otherwise, returns the argument.public static long checkPositive(long i, 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 i, 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 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–2018 The Netty Project. All rights reserved.