public class ModelException extends RuntimeException
Modifier and Type | Field and Description |
---|---|
private static long |
serialVersionUID |
Constructor and Description |
---|
ModelException(String message)
Creates a new instance of
ModelException . |
ModelException(String message,
Throwable cause)
Creates a new instance of
ModelException . |
Modifier and Type | Method and Description |
---|---|
static String |
buildErrorMessage(String errorMessage,
Object... parameters)
Builds the error message from the given message and parameters.
|
static void |
mustExist(Object value,
String errorMessage,
Object... parameters)
Throws a
ModelException if the given value is null . |
static void |
test(boolean condition,
String errorMessage,
Object... parameters)
Throws a
ModelException if the given condition is not met. |
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
private static final long serialVersionUID
public ModelException(String message)
ModelException
.message
- the message of the exceptionpublic ModelException(String message, Throwable cause)
ModelException
.message
- the detail message of the exceptioncause
- the origin of this exceptionpublic static String buildErrorMessage(String errorMessage, Object... parameters)
errorMessage
- the message, each of {}
is replaced by one of the given parametersparameters
- the optional parameters for the error messagepublic static void mustExist(Object value, String errorMessage, Object... parameters)
ModelException
if the given value is null
.value
- the value that should not be null
errorMessage
- the message to include in the exception, if the value is null
, each of {}
is
replaced by one of the given parametersparameters
- the optional parameters for the error messageModelException
- if the value is null
public static void test(boolean condition, String errorMessage, Object... parameters)
ModelException
if the given condition is not met.condition
- the condition to checkerrorMessage
- the message to include in the exception, if the condition is not true
, each of {}
is replaced by one of the given parametersparameters
- the optional parameters for the error messageModelException
- if the condition is false
Copyright © 2022 fastnate.org. All rights reserved.