public class ValidationException
extends java.lang.Exception
Constructor and Description |
---|
ValidationException(java.lang.String message)
Constructor with message.
|
ValidationException(java.lang.String message,
java.lang.Throwable cause)
Constructor with message and cause.
|
Modifier and Type | Method and Description |
---|---|
static void |
on(boolean condition,
java.lang.String format,
java.lang.Object... args)
Shorthand for checking a boolean flag and throwing a ValidationException if the flag is true.
|
static void |
unless(boolean condition,
java.lang.String format,
java.lang.Object... args)
Shorthand for checking a boolean flag and throwing a ValidationException if the flag is false.
|
public ValidationException(java.lang.String message)
message
- Message to the user why the command is not valid.public ValidationException(java.lang.String message, java.lang.Throwable cause)
message
- Message to the user why the command is not valid.cause
- Cause of the ValidationException.public static void on(boolean condition, java.lang.String format, java.lang.Object... args) throws ValidationException
condition
- throw a ValidationException if condition evaluates to true.format
- Template for the message with '%' as place holders.args
- substitution arguments for the '%' symbols in the format.ValidationException
- if condition evaluates to true.public static void unless(boolean condition, java.lang.String format, java.lang.Object... args) throws ValidationException
condition
- throw a ValidationException if condition evaluates to false.format
- Template for the message with '%' as place holders.args
- substitution arguments for the '%' symbols in the format.ValidationException
- if condition evaluates to false.