public class DefaultExceptionFactory extends Object implements ExceptionFactory
ExceptionFactory.
In order to create the Exception instances, it scans
the requested Classes for a public Constructor
which receives two arguments assignable from ValidationResult
and MuleEvent. If it's not found, a new search is done
looking for a constructor with a single argument assignable from
ValidationResult. If such Constructor is not found
then it tries with a default one. If it's still not found then
an IllegalArgumentException exception is thrown because
the requested Class does not comply with the rules of this
factory. For performance reasons, the Constructor chosen
for each class are cached.ExceptionFactory| Constructor and Description |
|---|
DefaultExceptionFactory() |
| Modifier and Type | Method and Description |
|---|---|
<T extends Exception> |
createException(ValidationResult result,
Class<T> exceptionClass,
MuleEvent event)
Creates an exception of the given
exceptionClass
which represents the given result. |
Exception |
createException(ValidationResult result,
String exceptionClassName,
MuleEvent event)
Creates an exception of the given
exceptionClassName
which represents the given result. |
public <T extends Exception> T createException(ValidationResult result, Class<T> exceptionClass, MuleEvent event)
ExceptionFactoryexceptionClass
which represents the given result.
The actual rules about what conditions is exceptionClass
expected to meet (e.g: presence of default constructor)
are up to the implementations.createException in interface ExceptionFactoryT - the type of the exception to be createdresult - a ValidationResult which contains information about an errorexceptionClass - the Class of the exception to be createdevent - the MuleEvent on which validation failedException if type Tpublic Exception createException(ValidationResult result, String exceptionClassName, MuleEvent event)
ExceptionFactoryexceptionClassName
which represents the given result.
The actual rules about what conditions is the exception Class
expected to meet (e.g: presence of default constructor)
are up to the implementations.createException in interface ExceptionFactoryresult - a ValidationResult which contains information about an errorexceptionClassName - the name of the exception Class to be thrownevent - the MuleEvent on which validation failedException of type exceptionClassNameCopyright © 2003–2023 MuleSoft, Inc.. All rights reserved.