@ThreadSafety(level=COMPLETELY_THREADSAFE) public final class Validator extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static void |
ensureFalse(boolean condition)
Ensures that the provided condition is
false. |
static void |
ensureFalse(boolean condition,
java.lang.String message)
Ensures that the provided condition is
false. |
static void |
ensureNotNull(java.lang.Object o)
Ensures that the provided object is not
null. |
static void |
ensureNotNull(java.lang.Object o1,
java.lang.Object o2)
Ensures that none of the provided objects is
null. |
static void |
ensureNotNull(java.lang.Object o1,
java.lang.Object o2,
java.lang.Object o3)
Ensures that none of the provided objects is
null. |
static void |
ensureNotNull(java.lang.Object o1,
java.lang.Object o2,
java.lang.Object o3,
java.lang.Object o4)
Ensures that none of the provided objects is
null. |
static void |
ensureNotNull(java.lang.Object o1,
java.lang.Object o2,
java.lang.Object o3,
java.lang.Object o4,
java.lang.Object o5)
Ensures that none of the provided objects is
null. |
static void |
ensureNotNullOrEmpty(byte[] array)
Ensures that the provided array is not
null and has a length of at
least one. |
static void |
ensureNotNullOrEmpty(byte[] array,
java.lang.String message)
Ensures that the provided array is not
null and has a length of at
least one. |
static void |
ensureNotNullOrEmpty(char[] array)
Ensures that the provided array is not
null and has a length of at
least one. |
static void |
ensureNotNullOrEmpty(char[] array,
java.lang.String message)
Ensures that the provided array is not
null and has a length of at
least one. |
static void |
ensureNotNullOrEmpty(java.lang.CharSequence charSequence)
Ensures that the provided character sequence is not
null and has a
length of at least one. |
static void |
ensureNotNullOrEmpty(java.lang.CharSequence charSequence,
java.lang.String message)
Ensures that the provided character sequence is not
null and has a
length of at least one. |
static void |
ensureNotNullOrEmpty(java.util.Collection<?> collection)
Ensures that the provided collection is not
null and contains at
least one item. |
static void |
ensureNotNullOrEmpty(java.util.Collection<?> collection,
java.lang.String message)
Ensures that the provided collection is not
null and contains at
least one item. |
static void |
ensureNotNullOrEmpty(int[] array)
Ensures that the provided array is not
null and has a length of at
least one. |
static void |
ensureNotNullOrEmpty(int[] array,
java.lang.String message)
Ensures that the provided array is not
null and has a length of at
least one. |
static void |
ensureNotNullOrEmpty(long[] array)
Ensures that the provided array is not
null and has a length of at
least one. |
static void |
ensureNotNullOrEmpty(long[] array,
java.lang.String message)
Ensures that the provided array is not
null and has a length of at
least one. |
static void |
ensureNotNullOrEmpty(java.util.Map<?,?> map)
Ensures that the provided map is not
null and contains at least one
item. |
static void |
ensureNotNullOrEmpty(java.util.Map<?,?> map,
java.lang.String message)
Ensures that the provided map is not
null and contains at least one
item. |
static void |
ensureNotNullOrEmpty(java.lang.Object[] array)
Ensures that the provided array is not
null and has a length of at
least one. |
static void |
ensureNotNullOrEmpty(java.lang.Object[] array,
java.lang.String message)
Ensures that the provided array is not
null and has a length of at
least one. |
static void |
ensureNotNullWithMessage(java.lang.Object o,
java.lang.String message)
Ensures that the provided object is not
null. |
static void |
ensureTrue(boolean condition)
Ensures that the provided condition is
true. |
static void |
ensureTrue(boolean condition,
java.lang.String message)
Ensures that the provided condition is
true. |
static void |
violation(java.lang.String message)
Indicates that an expected condition was not true by throwing an
LDAPSDKUsageException with the provided information. |
static void |
violation(java.lang.String message,
java.lang.Throwable cause)
Indicates that an expected condition was not true by throwing an
LDAPSDKUsageException with the provided information. |
public static void ensureNotNull(@Nullable java.lang.Object o) throws LDAPSDKUsageException
null.o - The object to examine.LDAPSDKUsageException - If the provided object is null.public static void ensureNotNullWithMessage(@Nullable java.lang.Object o, @NotNull java.lang.String message) throws LDAPSDKUsageException
null.o - The object to examine.message - The message to include in the exception thrown if the
provided object is null.LDAPSDKUsageException - If the provided object is null.public static void ensureNotNull(@Nullable java.lang.Object o1, @Nullable java.lang.Object o2) throws LDAPSDKUsageException
null.o1 - The first object for which to make the determination.o2 - The second object for which to make the determination.LDAPSDKUsageException - If any of the provided objects is
null.public static void ensureNotNull(@Nullable java.lang.Object o1, @Nullable java.lang.Object o2, @Nullable java.lang.Object o3) throws LDAPSDKUsageException
null.o1 - The first object for which to make the determination.o2 - The second object for which to make the determination.o3 - The third object for which to make the determination.LDAPSDKUsageException - If any of the provided objects is
null.public static void ensureNotNull(@Nullable java.lang.Object o1, @Nullable java.lang.Object o2, @Nullable java.lang.Object o3, @Nullable java.lang.Object o4) throws LDAPSDKUsageException
null.o1 - The first object for which to make the determination.o2 - The second object for which to make the determination.o3 - The third object for which to make the determination.o4 - The fourth object for which to make the determination.LDAPSDKUsageException - If any of the provided objects is
null.public static void ensureNotNull(@Nullable java.lang.Object o1, @Nullable java.lang.Object o2, @Nullable java.lang.Object o3, @Nullable java.lang.Object o4, @Nullable java.lang.Object o5) throws LDAPSDKUsageException
null.o1 - The first object for which to make the determination.o2 - The second object for which to make the determination.o3 - The third object for which to make the determination.o4 - The fourth object for which to make the determination.o5 - The fifth object for which to make the determination.LDAPSDKUsageException - If any of the provided objects is
null.public static void ensureNotNullOrEmpty(@Nullable java.util.Collection<?> collection)
null and contains at
least one item.collection - The collection to verify.LDAPSDKUsageException - If the provided collection is null
or empty.public static void ensureNotNullOrEmpty(@Nullable java.util.Collection<?> collection, @NotNull java.lang.String message)
null and contains at
least one item.collection - The collection to verify.message - The message to include in the exception thrown if the
provided collection is null or empty.LDAPSDKUsageException - If the provided collection is null
or empty.public static void ensureNotNullOrEmpty(@Nullable java.util.Map<?,?> map)
null and contains at least one
item.map - The map to verify.LDAPSDKUsageException - If the provided map is null or
empty.public static void ensureNotNullOrEmpty(@Nullable java.util.Map<?,?> map, @NotNull java.lang.String message)
null and contains at least one
item.map - The map to verify.message - The message to include in the exception thrown if the
provided map is null or empty.LDAPSDKUsageException - If the provided map is null or
empty.public static void ensureNotNullOrEmpty(@Nullable java.lang.Object[] array)
null and has a length of at
least one.array - The array to verify.LDAPSDKUsageException - If the provided array is null or
empty.public static void ensureNotNullOrEmpty(@Nullable java.lang.Object[] array, @NotNull java.lang.String message)
null and has a length of at
least one.array - The array to verify.message - The message to include in the exception thrown if the
provided array is null or empty.LDAPSDKUsageException - If the provided array is null or
empty.public static void ensureNotNullOrEmpty(@Nullable byte[] array)
null and has a length of at
least one.array - The array to verify.LDAPSDKUsageException - If the provided array is null or
empty.public static void ensureNotNullOrEmpty(@Nullable byte[] array, @NotNull java.lang.String message)
null and has a length of at
least one.array - The array to verify.message - The message to include in the exception thrown if the
provided array is null or empty.LDAPSDKUsageException - If the provided array is null or
empty.public static void ensureNotNullOrEmpty(@Nullable char[] array)
null and has a length of at
least one.array - The array to verify.LDAPSDKUsageException - If the provided array is null or
empty.public static void ensureNotNullOrEmpty(@Nullable char[] array, @NotNull java.lang.String message)
null and has a length of at
least one.array - The array to verify.message - The message to include in the exception thrown if the
provided array is null or empty.LDAPSDKUsageException - If the provided array is null or
empty.public static void ensureNotNullOrEmpty(@Nullable int[] array)
null and has a length of at
least one.array - The array to verify.LDAPSDKUsageException - If the provided array is null or
empty.public static void ensureNotNullOrEmpty(@Nullable int[] array, @NotNull java.lang.String message)
null and has a length of at
least one.array - The array to verify.message - The message to include in the exception thrown if the
provided array is null or empty.LDAPSDKUsageException - If the provided array is null or
empty.public static void ensureNotNullOrEmpty(@Nullable long[] array)
null and has a length of at
least one.array - The array to verify.LDAPSDKUsageException - If the provided array is null or
empty.public static void ensureNotNullOrEmpty(@Nullable long[] array, @NotNull java.lang.String message)
null and has a length of at
least one.array - The array to verify.message - The message to include in the exception thrown if the
provided array is null or empty.LDAPSDKUsageException - If the provided array is null or
empty.public static void ensureNotNullOrEmpty(@Nullable java.lang.CharSequence charSequence)
null and has a
length of at least one.charSequence - The character sequence to verify.LDAPSDKUsageException - If the provided character sequence is
null or empty.public static void ensureNotNullOrEmpty(@Nullable java.lang.CharSequence charSequence, @NotNull java.lang.String message)
null and has a
length of at least one.charSequence - The character sequence to verify.message - The message to include in the exception thrown if
the provided character sequence is null or
empty.LDAPSDKUsageException - If the provided character sequence is
null or empty.public static void ensureTrue(boolean condition) throws LDAPSDKUsageException
true.condition - The condition to verify.LDAPSDKUsageException - If the provided condition is false.public static void ensureTrue(boolean condition, @NotNull java.lang.String message) throws LDAPSDKUsageException
true.condition - The condition to verify.message - The message to include in the exception thrown if the
provided object is null.LDAPSDKUsageException - If the provided condition is false.public static void ensureFalse(boolean condition) throws LDAPSDKUsageException
false.condition - The condition to verify.LDAPSDKUsageException - If the provided condition is true.public static void ensureFalse(boolean condition, @NotNull java.lang.String message) throws LDAPSDKUsageException
false.condition - The condition to verify.message - The message to include in the exception thrown if the
provided object is null.LDAPSDKUsageException - If the provided condition is true.public static void violation(@NotNull java.lang.String message) throws LDAPSDKUsageException
LDAPSDKUsageException with the provided information.message - The message to use for the resulting exception. It must
not be null.LDAPSDKUsageException - To indicate that a violation occurred.public static void violation(@NotNull java.lang.String message, @Nullable java.lang.Throwable cause) throws LDAPSDKUsageException
LDAPSDKUsageException with the provided information.message - The message to use for the resulting exception. It must
not be null.cause - The exception that triggered the violation. It may be
null if there is no associated exception.LDAPSDKUsageException - To indicate that a violation occurred.