public final class ValidationUtils
extends java.lang.Object
A validation utility class.
| Modifier and Type | Method and Description |
|---|---|
static boolean |
isValidCollectionName(java.lang.String name)
Determines if a string is a valid collection name.
|
static void |
notEmpty(java.lang.CharSequence value,
ErrorMessage message)
Validates if a
CharSequence is empty or null. |
static void |
notEmpty(java.lang.Object[] array,
ErrorMessage message)
Validates if an object array is empty.
|
static void |
notEmpty(java.lang.String value,
ErrorMessage message)
Validates if a string is empty or
null. |
static void |
notNull(java.lang.Object value,
ErrorMessage message)
Validates if an object is
null. |
static void |
validateCollectionName(java.lang.String name)
Validates a collection name.
|
static void |
validateDocumentIndexField(java.lang.Object fieldValue,
java.lang.String field)
Validates if a field of a document can be indexed.
|
static void |
validateInFilterValue(java.lang.String field,
java.lang.Object[] values)
Validates an In filter value.
|
static void |
validateLimit(FindOptions findOptions,
long totalSize)
Validates pagination limit in
FindOptions against the total size. |
static void |
validateSearchTerm(NitriteMapper nitriteMapper,
java.lang.String field,
java.lang.Object value)
Validates a search term.
|
public static void notEmpty(java.lang.String value,
ErrorMessage message)
Validates if a string is empty or null.
value - the string valuemessage - the error messagepublic static void notEmpty(java.lang.CharSequence value,
ErrorMessage message)
Validates if a CharSequence is empty or null.
value - the valuemessage - the messagepublic static void notNull(java.lang.Object value,
ErrorMessage message)
Validates if an object is null.
value - the objectmessage - the messagepublic static void notEmpty(java.lang.Object[] array,
ErrorMessage message)
Validates if an object array is empty.
array - the object arraymessage - the messagepublic static void validateCollectionName(java.lang.String name)
Validates a collection name.
name - the namepublic static boolean isValidCollectionName(java.lang.String name)
Determines if a string is a valid collection name.
name - the nametrue if valid; false otherwise.public static void validateLimit(FindOptions findOptions, long totalSize)
Validates pagination limit in FindOptions against the total size.
findOptions - the FindOptionstotalSize - the total sizepublic static void validateDocumentIndexField(java.lang.Object fieldValue,
java.lang.String field)
Validates if a field of a document can be indexed.
fieldValue - the field valuefield - the fieldpublic static void validateSearchTerm(NitriteMapper nitriteMapper, java.lang.String field, java.lang.Object value)
Validates a search term.
nitriteMapper - the NitriteMapperfield - the fieldvalue - the valuepublic static void validateInFilterValue(java.lang.String field,
java.lang.Object[] values)
Validates an In filter value.
field - the fieldvalues - the values