Package com.github.javaparser.quality
Class Preconditions
java.lang.Object
com.github.javaparser.quality.Preconditions
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
checkArgument
(boolean expression) Ensures the truth of an expression involving one or more parameters to the calling method.static void
checkArgument
(boolean expression, Object message) Ensures the truth of an expression involving one or more parameters to the calling method.static void
checkNotNull
(Object reference) Ensures that an object reference passed as a parameter to the calling method is not null.static void
checkNotNull
(Object reference, Object message) Ensures that an object reference passed as a parameter to the calling method is not null.
-
Constructor Details
-
Preconditions
private Preconditions()
-
-
Method Details
-
checkArgument
Ensures the truth of an expression involving one or more parameters to the calling method.- Parameters:
expression
- a boolean expression.message
- the exception message to use if the check fails; will be converted to a string using String.valueOf(Object)- Throws:
IllegalArgumentException
- if expression is false.
-
checkArgument
public static void checkArgument(boolean expression) Ensures the truth of an expression involving one or more parameters to the calling method.- Parameters:
expression
- a boolean expression.- Throws:
IllegalArgumentException
- if expression is false.
-
checkNotNull
Ensures that an object reference passed as a parameter to the calling method is not null.- Parameters:
reference
- an object reference.message
- the exception message to use if the check fails; will be converted to a string using String.valueOf(Object)- Throws:
IllegalArgumentException
- if reference isnull
.
-
checkNotNull
Ensures that an object reference passed as a parameter to the calling method is not null.- Parameters:
reference
- an object reference.- Throws:
IllegalArgumentException
- if reference isnull
.
-