Package org.apache.parquet
Class Preconditions
- java.lang.Object
-
- org.apache.parquet.Preconditions
-
public final class Preconditions extends Object
Utility for parameter validation
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description 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 <T> TcheckNotNull(T o, String name)Deprecated.static voidcheckState(boolean isValid, String message)Precondition-style validation that throwsIllegalStateException.static voidcheckState(boolean isValid, String message, Object... args)Precondition-style validation that throwsIllegalStateException.
-
-
-
Method Detail
-
checkNotNull
@Deprecated public static <T> T checkNotNull(T o, String name) throws NullPointerException
Deprecated.- Type Parameters:
T- the type of the object- Parameters:
o- the param to checkname- the name of the param for the error message- Returns:
- the validated o
- Throws:
NullPointerException- if o is null
-
checkArgument
public static void checkArgument(boolean isValid, String message) throws IllegalArgumentExceptionPrecondition-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 IllegalArgumentExceptionPrecondition-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
public static void checkState(boolean isValid, String message) throws IllegalStateExceptionPrecondition-style validation that throwsIllegalStateException.- Parameters:
isValid-trueif valid,falseif an exception should be thrownmessage- A String message for the exception.- Throws:
IllegalStateException- ifisValidis false
-
checkState
public static void checkState(boolean isValid, String message, Object... args) throws IllegalStateExceptionPrecondition-style validation that throwsIllegalStateException.- 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:
IllegalStateException- ifisValidis false
-
-