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 void
checkArgument(boolean isValid, String message)
Precondition-style validation that throwsIllegalArgumentException
.static void
checkArgument(boolean isValid, String message, Object arg0)
Precondition-style validation that throwsIllegalArgumentException
.static void
checkArgument(boolean isValid, String message, Object... args)
Precondition-style validation that throwsIllegalArgumentException
.static void
checkArgument(boolean isValid, String message, Object arg0, Object arg1)
Precondition-style validation that throwsIllegalArgumentException
.static void
checkArgument(boolean isValid, String message, Object arg0, Object arg1, Object arg2)
Precondition-style validation that throwsIllegalArgumentException
.static <T> T
checkNotNull(T o, String name)
Deprecated.static void
checkState(boolean isValid, String message)
Precondition-style validation that throwsIllegalStateException
.static void
checkState(boolean isValid, String message, Object arg0)
Precondition-style validation that throwsIllegalStateException
.static void
checkState(boolean isValid, String message, Object... args)
Precondition-style validation that throwsIllegalStateException
.static void
checkState(boolean isValid, String message, Object arg0, Object arg1)
Precondition-style validation that throwsIllegalStateException
.static void
checkState(boolean isValid, String message, Object arg0, Object arg1, Object arg2)
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 IllegalArgumentException
Precondition-style validation that throwsIllegalArgumentException
.- Parameters:
isValid
-true
if valid,false
if an exception should be thrownmessage
- A String message for the exception.- Throws:
IllegalArgumentException
- ifisValid
is false
-
checkArgument
public static void checkArgument(boolean isValid, String message, Object arg0) throws IllegalArgumentException
Precondition-style validation that throwsIllegalArgumentException
.- Parameters:
isValid
-true
if valid,false
if an exception should be thrownmessage
- A String message for the exception.arg0
- First parameter of the message string template- Throws:
IllegalArgumentException
- ifisValid
is false
-
checkArgument
public static void checkArgument(boolean isValid, String message, Object arg0, Object arg1) throws IllegalArgumentException
Precondition-style validation that throwsIllegalArgumentException
.- Parameters:
isValid
-true
if valid,false
if an exception should be thrownmessage
- A String message for the exception.arg0
- First parameter of the message string templatearg1
- Second parameter of the message string template- Throws:
IllegalArgumentException
- ifisValid
is false
-
checkArgument
public static void checkArgument(boolean isValid, String message, Object arg0, Object arg1, Object arg2) throws IllegalArgumentException
Precondition-style validation that throwsIllegalArgumentException
.- Parameters:
isValid
-true
if valid,false
if an exception should be thrownmessage
- A String message for the exception.arg0
- First parameter of the message string templatearg1
- Second parameter of the message string templatearg2
- Third parameter of the message string template- Throws:
IllegalArgumentException
- ifisValid
is false
-
checkArgument
public static void checkArgument(boolean isValid, String message, Object... args) throws IllegalArgumentException
Precondition-style validation that throwsIllegalArgumentException
.- Parameters:
isValid
-true
if valid,false
if an exception should be thrownmessage
- A String message for the exception.args
- Objects used to fill in%s
placeholders in the message- Throws:
IllegalArgumentException
- ifisValid
is false
-
checkState
public static void checkState(boolean isValid, String message) throws IllegalStateException
Precondition-style validation that throwsIllegalStateException
.- Parameters:
isValid
-true
if valid,false
if an exception should be thrownmessage
- A String message for the exception.- Throws:
IllegalStateException
- ifisValid
is false
-
checkState
public static void checkState(boolean isValid, String message, Object arg0) throws IllegalStateException
Precondition-style validation that throwsIllegalStateException
.- Parameters:
isValid
-true
if valid,false
if an exception should be thrownmessage
- A String message for the exception.arg0
- First parameter of the message string template- Throws:
IllegalStateException
- ifisValid
is false
-
checkState
public static void checkState(boolean isValid, String message, Object arg0, Object arg1) throws IllegalStateException
Precondition-style validation that throwsIllegalStateException
.- Parameters:
isValid
-true
if valid,false
if an exception should be thrownmessage
- A String message for the exception.arg0
- First parameter of the message string templatearg1
- Second parameter of the message string template- Throws:
IllegalStateException
- ifisValid
is false
-
checkState
public static void checkState(boolean isValid, String message, Object arg0, Object arg1, Object arg2) throws IllegalStateException
Precondition-style validation that throwsIllegalStateException
.- Parameters:
isValid
-true
if valid,false
if an exception should be thrownmessage
- A String message for the exception.arg0
- First parameter of the message string templatearg1
- Second parameter of the message string templatearg2
- Third parameter of the message string template- Throws:
IllegalStateException
- ifisValid
is false
-
checkState
public static void checkState(boolean isValid, String message, Object... args) throws IllegalStateException
Precondition-style validation that throwsIllegalStateException
.- Parameters:
isValid
-true
if valid,false
if an exception should be thrownmessage
- A String message for the exception.args
- Objects used to fill in%s
placeholders in the message- Throws:
IllegalStateException
- ifisValid
is false
-
-