Class Validate
- java.lang.Object
-
- org.apache.jackrabbit.oak.commons.conditions.Validate
-
public final class Validate extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
checkArgument(boolean expression)
Checks the specified expressionstatic void
checkArgument(boolean expression, @NotNull String message)
Checks the specified expressionstatic void
checkArgument(boolean expression, @NotNull String messageTemplate, @Nullable Object... messageArgs)
Checks the specified expressionstatic void
checkState(boolean expression)
Checks whether the specified expression is truestatic void
checkState(boolean expression, @NotNull Object errorMessage)
Checks whether the specified expression is truestatic void
checkState(boolean expression, @NotNull String messageTemplate, @Nullable Object... messageArgs)
Checks whether the specified expression is true
-
-
-
Method Detail
-
checkArgument
public static void checkArgument(boolean expression) throws IllegalArgumentException
Checks the specified expression- Parameters:
expression
- to check- Throws:
IllegalArgumentException
- when false
-
checkArgument
public static void checkArgument(boolean expression, @NotNull @NotNull String message) throws IllegalArgumentException
Checks the specified expression- Parameters:
expression
- to checkmessage
- to use in exception- Throws:
IllegalArgumentException
- when false
-
checkArgument
public static void checkArgument(boolean expression, @NotNull @NotNull String messageTemplate, @Nullable @Nullable Object... messageArgs)
Checks the specified expression- Parameters:
expression
- to checksmessageTemplate
- to use in exception (usingString.format(java.lang.String, java.lang.Object...)
syntax- Throws:
IllegalArgumentException
- when false
-
checkState
public static void checkState(boolean expression)
Checks whether the specified expression is true- Parameters:
expression
- expression to checks- Throws:
IllegalStateException
- if expression is false
-
checkState
public static void checkState(boolean expression, @NotNull @NotNull Object errorMessage)
Checks whether the specified expression is true- Parameters:
expression
- expression to checkserrorMessage
- message to use in exception- Throws:
IllegalStateException
- if expression is false
-
checkState
public static void checkState(boolean expression, @NotNull @NotNull String messageTemplate, @Nullable @Nullable Object... messageArgs)
Checks whether the specified expression is true- Parameters:
expression
- expression to checksmessageTemplate
- to use in exception (usingString.format(java.lang.String, java.lang.Object...)
syntaxmessageArgs
- arguments to use in messageTemplate- Throws:
IllegalArgumentException
- if expression is false
-
-