@Private
public class Check
extends java.lang.Object
Commonly used for method arguments preconditions.
| Constructor | Description |
|---|---|
Check() |
| Modifier and Type | Method | Description |
|---|---|---|
static int |
ge0(int value,
java.lang.String name) |
Verifies an integer is greater or equal to zero.
|
static long |
ge0(long value,
java.lang.String name) |
Verifies an long is greater or equal to zero.
|
static int |
gt0(int value,
java.lang.String name) |
Verifies an integer is greater than zero.
|
static long |
gt0(long value,
java.lang.String name) |
Verifies an long is greater than zero.
|
static java.lang.String |
notEmpty(java.lang.String str,
java.lang.String name) |
Verifies a string is not NULL and not emtpy
|
static java.util.List<java.lang.String> |
notEmptyElements(java.util.List<java.lang.String> list,
java.lang.String name) |
Verifies a string list is not NULL and not emtpy
|
static <T> T |
notNull(T obj,
java.lang.String name) |
Verifies a variable is not NULL.
|
static <T> java.util.List<T> |
notNullElements(java.util.List<T> list,
java.lang.String name) |
Verifies a list does not have any NULL elements.
|
static java.lang.String |
validIdentifier(java.lang.String value,
int maxLen,
java.lang.String name) |
Verifies a value is a valid identifier,
[a-zA-Z_][a-zA-Z0-9_\-]*, up to a maximum length. |
public static <T> T notNull(T obj,
java.lang.String name)
obj - the variable to check.name - the name to use in the exception message.java.lang.IllegalArgumentException - if the variable is NULL.public static <T> java.util.List<T> notNullElements(java.util.List<T> list,
java.lang.String name)
list - the list to check.name - the name to use in the exception message.java.lang.IllegalArgumentException - if the list has NULL elements.public static java.lang.String notEmpty(java.lang.String str,
java.lang.String name)
str - the variable to check.name - the name to use in the exception message.java.lang.IllegalArgumentException - if the variable is NULL or empty.public static java.util.List<java.lang.String> notEmptyElements(java.util.List<java.lang.String> list,
java.lang.String name)
list - the list to check.name - the name to use in the exception message.java.lang.IllegalArgumentException - if the string list has NULL or empty
elements.public static java.lang.String validIdentifier(java.lang.String value,
int maxLen,
java.lang.String name)
[a-zA-Z_][a-zA-Z0-9_\-]*, up to a maximum length.value - string to check if it is a valid identifier.maxLen - maximun length.name - the name to use in the exception message.java.lang.IllegalArgumentException - if the string is not a valid identifier.public static int gt0(int value,
java.lang.String name)
value - integer value.name - the name to use in the exception message.java.lang.IllegalArgumentException - if the integer is zero or less.public static long gt0(long value,
java.lang.String name)
value - long value.name - the name to use in the exception message.java.lang.IllegalArgumentException - if the long is zero or less.public static int ge0(int value,
java.lang.String name)
value - integer value.name - the name to use in the exception message.java.lang.IllegalArgumentException - if the integer is greater or equal to zero.public static long ge0(long value,
java.lang.String name)
value - integer value.name - the name to use in the exception message.java.lang.IllegalArgumentException - if the long is greater or equal to zero.Copyright © 2008–2025 Apache Software Foundation. All rights reserved.