public final class Validate extends Object
| Modifier and Type | Method and Description |
|---|---|
static boolean |
isNullOrEmpty(String string)
Checks that the specified String is not null or empty.
|
static boolean |
isNullOrEmptyOrQuestionMark(String string)
Checks that the specified String is not null or empty or question mark "?".
|
static boolean |
isReadable(File path) |
static void |
isReadable(File file,
String message)
Checks that the specified
File is not null, exists and represents a readable file, throws exception if it is
empty or null and does not represent a path to a file. |
static void |
isReadable(String path,
String message)
Checks that the specified String is not null or empty and represents a readable file, throws exception if it is
empty or null and does not represent a path to a file.
|
static void |
notEmpty(Collection<?> collection,
String message)
Checks that collection is not
null or empty, throws exception if it is. |
static void |
notNull(Object obj,
String message)
Checks that object is not null, throws exception if it is.
|
static void |
notNullAndNoNullValues(Object[] objects,
String message)
Checks that the specified array is not null or contain any null values.
|
static void |
notNullOrEmpty(String string,
String message)
Checks that the specified String is not null or empty, throws exception if it is.
|
static void |
readable(File path,
String message)
Checks that the specified String is not null or empty and represents a readable file, throws exception if it is
empty or null and does not represent a path to a file.
|
static void |
readable(String path,
String message)
Checks that the specified String is not null or empty and represents a readable file, throws exception if it is
empty or null and does not represent a path to a file.
|
static void |
stateNotNull(Object obj,
String message)
Checks that object is not null, throws exception if it is.
|
static void |
writeableDirectory(String path,
String message)
Checks that the specified String is not null or empty and represents a writeable directory, throws exception if
it is empty or null and does not represent a path to a directory.
|
public static void notNull(Object obj, String message) throws IllegalArgumentException
obj - The object to checkmessage - The exception messageIllegalArgumentException - Thrown if obj is nullpublic static void stateNotNull(Object obj, String message) throws IllegalStateException
obj - The object to checkmessage - The exception messageIllegalStateException - Thrown if obj is nullpublic static void notEmpty(Collection<?> collection, String message) throws IllegalArgumentException
null or empty, throws exception if it is.collection - The collection to be checkedmessage - The exception messageIllegalArgumentException - Thrown if collection is null or emptypublic static boolean isNullOrEmpty(String string)
string - The object to checktrue if specified String is null or empty, false otherwisepublic static boolean isNullOrEmptyOrQuestionMark(String string)
string - The object to checktrue if specified String is null or empty, false otherwisepublic static void notNullOrEmpty(String string, String message) throws IllegalArgumentException
string - The object to checkmessage - The exception messageIllegalArgumentException - Thrown if string is nullpublic static void readable(String path, String message) throws IllegalArgumentException
path - The path to checkmessage - The exception messageIllegalArgumentException - Thrown if path is empty, null or invalidpublic static void readable(File path, String message) throws IllegalArgumentException
path - The path to checkmessage - The exception messageIllegalArgumentException - Thrown if path is empty, null or invalidpublic static boolean isReadable(File path)
public static void writeableDirectory(String path, String message) throws IllegalArgumentException
path - The path to checkmessage - The exception messageIllegalArgumentException - Thrown if path is empty, null or invalidpublic static void notNullAndNoNullValues(Object[] objects, String message)
objects - The object to checkmessage - The exception messagepublic static void isReadable(File file, String message) throws IllegalArgumentException
File is not null, exists and represents a readable file, throws exception if it is
empty or null and does not represent a path to a file.file - The File to checkmessage - The exception messageIllegalArgumentException - Thrown if path is empty, null or invalidpublic static void isReadable(String path, String message) throws IllegalArgumentException
path - The path to checkmessage - The exception messageIllegalArgumentException - Thrown if path is empty, null or invalidCopyright © 2019 JBoss by Red Hat. All rights reserved.