public class DefaultExceptionFactory extends Object implements ExceptionFactory
ExceptionFactory
.
In order to create the Exception
instances, it scans
the requested Class
es 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)
ExceptionFactory
exceptionClass
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 ExceptionFactory
T
- 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 T
public Exception createException(ValidationResult result, String exceptionClassName, MuleEvent event)
ExceptionFactory
exceptionClassName
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 ExceptionFactory
result
- 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 exceptionClassName
Copyright © 2003–2016 MuleSoft, Inc.. All rights reserved.