Package com.amilesend.client.util
Class Validate
java.lang.Object
com.amilesend.client.util.Validate
Utility methods used to validate method input.
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
Throws an exception if the given expression is false.static void
notBlank
(CharSequence chars, String message) Throws an exception if the givenchars
is blank.static void
notEmpty
(Collection<?> collection, String message) Throws an exception if the givencollection
is empty.static void
Throws an exception if the givenmap
is empty.static void
Throws an exception if the given object isnull
.
-
Method Details
-
notBlank
Throws an exception if the givenchars
is blank.- Parameters:
chars
- the character sequence to validatemessage
- the message to include in the exception thrown- Throws:
NullPointerException
- if the char sequence is nullIllegalArgumentException
- if the char sequence is not blank
-
notEmpty
Throws an exception if the givencollection
is empty.- Parameters:
collection
- the collection to validatemessage
- the message to include in the exception thrown- Throws:
NullPointerException
- if the collection is nullIllegalArgumentException
- if the collection is not blank
-
notEmpty
Throws an exception if the givenmap
is empty.- Parameters:
map
- the map to validatemessage
- the message to include in the exception thrown- Throws:
NullPointerException
- if the map is nullIllegalArgumentException
- if the map is not blank
-
isTrue
Throws an exception if the given expression is false.- Parameters:
exp
- the boolean expressionmessage
- the message to include in the exception thrown- Throws:
IllegalArgumentException
- if the expression is false
-
notNull
Throws an exception if the given object isnull
.- Parameters:
obj
- the objectmessage
- the message to include in the exception thrown- Throws:
NullPointerException
- if the object is null
-