Package com.avoka.tm.util
Class Contract
java.lang.Object
com.avoka.tm.util.Contract
Provides design by contract programming validation functions.
- Since:
- 5.0.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
checkReservedWords
(String[] reservedWords, String word) Check a word against a blacklist or whitelist of reserved wordsstatic boolean
checkSpecialChars
(String regex, String text) Search text for charactersstatic void
Ensure the specified condition value is true, or throw an IllegalArgumentExcpetion if false.static void
Validate specified parameter is not null, or blank throw a IllegalArgumentException if null or blank.static void
Validate specified parameter is not null, throw a IllegalArgumentException if null.
-
Method Details
-
isTrue
Ensure the specified condition value is true, or throw an IllegalArgumentExcpetion if false.- Parameters:
value
- the conditional value to testmessage
- the IllegalArgumentException message if the conditional value is false
-
notNull
Validate specified parameter is not null, throw a IllegalArgumentException if null.- Parameters:
paramValue
- the parameter value to verify not nullparamName
- the parameter name
-
notBlank
Validate specified parameter is not null, or blank throw a IllegalArgumentException if null or blank.- Parameters:
paramValue
- the parameter value to verify not null, or blankparamName
- the parameter name
-
checkSpecialChars
Search text for characters- Parameters:
regex
- regular expressiontext
- the searched text- Since:
- 23.10.0
-
checkReservedWords
Check a word against a blacklist or whitelist of reserved words- Parameters:
reservedWords
- list of stringword
- the string to be checked- Since:
- 23.10.0
-