Package org.fastnate.generator.context
Class ModelException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.fastnate.generator.context.ModelException
- All Implemented Interfaces:
Serializable
Thrown if the classes in the entity model are for some reason invalid.
- Author:
- Tobias Liefke
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionModelException(String message) Creates a new instance ofModelException.ModelException(String message, Throwable cause) Creates a new instance ofModelException. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringbuildErrorMessage(String errorMessage, Object... parameters) Builds the error message from the given message and parameters.static voidThrows aModelExceptionif the given value isnull.static voidThrows aModelExceptionif the given condition is not met.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
-
Constructor Details
-
ModelException
Creates a new instance ofModelException.- Parameters:
message- the message of the exception
-
ModelException
Creates a new instance ofModelException.- Parameters:
message- the detail message of the exceptioncause- the origin of this exception
-
-
Method Details
-
buildErrorMessage
Builds the error message from the given message and parameters.- Parameters:
errorMessage- the message, each of{}is replaced by one of the given parametersparameters- the optional parameters for the error message- Returns:
- the error message
-
mustExist
Throws aModelExceptionif the given value isnull.- Parameters:
value- the value that should not benullerrorMessage- the message to include in the exception, if the value isnull, each of{}is replaced by one of the given parametersparameters- the optional parameters for the error message- Throws:
ModelException- if the value isnull
-
test
Throws aModelExceptionif the given condition is not met.- Parameters:
condition- the condition to checkerrorMessage- the message to include in the exception, if the condition is nottrue, each of{}is replaced by one of the given parametersparameters- the optional parameters for the error message- Throws:
ModelException- if the condition isfalse
-