Package io.delta.kernel.internal.util
Class Preconditions
Object
io.delta.kernel.internal.util.Preconditions
Static convenience methods that help a method or constructor check whether it was invoked
correctly (that is, whether its preconditions were met).
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidcheckArgument(boolean isValid) Precondition-style validation that throwsIllegalArgumentException.static voidcheckArgument(boolean isValid, String message) Precondition-style validation that throwsIllegalArgumentException.static voidcheckArgument(boolean isValid, String message, Object... args) Precondition-style validation that throwsIllegalArgumentException.static voidcheckState(boolean expression, String errorMessage) Ensures the truth of an expression involving the state of the calling instance.
-
Method Details
-
checkArgument
Precondition-style validation that throwsIllegalArgumentException.- Parameters:
isValid-trueif valid,falseif an exception should be thrown- Throws:
IllegalArgumentException- ifisValidis false
-
checkArgument
Precondition-style validation that throwsIllegalArgumentException.- Parameters:
isValid-trueif valid,falseif an exception should be thrownmessage- A String message for the exception.- Throws:
IllegalArgumentException- ifisValidis false
-
checkArgument
public static void checkArgument(boolean isValid, String message, Object... args) throws IllegalArgumentException Precondition-style validation that throwsIllegalArgumentException.- Parameters:
isValid-trueif valid,falseif an exception should be thrownmessage- A String message for the exception.args- Objects used to fill in%splaceholders in the message- Throws:
IllegalArgumentException- ifisValidis false
-
checkState
Ensures the truth of an expression involving the state of the calling instance.- Parameters:
expression- a boolean expressionerrorMessage- the exception message to use if the check fails- Throws:
IllegalStateException- ifexpressionis false
-