Package com.groiss.util
Class Assert
java.lang.Object
com.groiss.util.Assert
Class for defining assertions.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
RuntimeException indicating that an assert failed. -
Method Summary
Modifier and TypeMethodDescriptionstatic final void
isFalse
(boolean expression) Throws an exception if the given expression is true.static final void
Throws an exception if the given expression is true.static final void
isTrue
(boolean expression) Throws an exception if the given expression is false.static final void
Throws an exception if the given expression is false.static final void
necessaryParameters
(HttpServletRequest req, String... names) Check the presence of parametersstatic final void
Throws an exception if the given argument is null.
-
Method Details
-
isTrue
public static final void isTrue(boolean expression) Throws an exception if the given expression is false. Hint: Use the method with extra message parameterisTrue(boolean,String)
- Parameters:
expression
- a boolean expression
-
isFalse
public static final void isFalse(boolean expression) Throws an exception if the given expression is true. Hint: Use the method with extra message parameterisFalse(boolean,String)
- Parameters:
expression
- a boolean expression
-
isTrue
Throws an exception if the given expression is false.- Parameters:
expression
- a boolean expressionmessage
- the message of the exception
-
isFalse
Throws an exception if the given expression is true.- Parameters:
expression
- a boolean expressionmessage
- the message of the exception
-
nonNull
Throws an exception if the given argument is null.- Parameters:
param
- an objectparamName
- the name used in the error message
-
necessaryParameters
Check the presence of parameters- Parameters:
req
- the requestnames
- list of parameter names
-