Class EcmsExceptionMapping<T extends Throwable>
java.lang.Object
com.lexmark.saperion.exceptions.mappings.EcmsExceptionMapping<T>
- Type Parameters:
T
- the mapped ecms exception type
- All Implemented Interfaces:
ExceptionMapping<T>
public class EcmsExceptionMapping<T extends Throwable>
extends Object
implements ExceptionMapping<T>
Base implementation of an exception mapping entry. An exception mapping entry associates an error code with an
EcmException
class.- Author:
- owaeldrich
-
Constructor Summary
ConstructorsConstructorDescriptionEcmsExceptionMapping
(com.lexmark.saperion.exceptions.ErrorConstantType errorCode, Class<T> exception) Creates a new exception mapping entry with the given error code and the given exception class. -
Method Summary
Modifier and TypeMethodDescriptioncreateException
(com.lexmark.saperion.exceptions.ErrorType fault, Throwable cause) Creates a new exception for the given server fault.createException
(String message) Creates a new exception for the given server fault.createException
(String message, Throwable cause) Creates a new exception for the given server fault.createException
(Throwable cause) Creates a new exception for the given server fault.com.lexmark.saperion.exceptions.ErrorCodeType
Returns the error code this exception mapping applies to.boolean
validate()
Validates the integrity of the exception mapping.
-
Constructor Details
-
Method Details
-
createException
Description copied from interface:ExceptionMapping
Creates a new exception for the given server fault.- Specified by:
createException
in interfaceExceptionMapping<T extends Throwable>
- Parameters:
fault
- the server errorcause
- the exception cause- Returns:
- the new exception
-
createException
Description copied from interface:ExceptionMapping
Creates a new exception for the given server fault.- Specified by:
createException
in interfaceExceptionMapping<T extends Throwable>
- Parameters:
message
- the error message- Returns:
- the new exception
-
createException
Description copied from interface:ExceptionMapping
Creates a new exception for the given server fault.- Specified by:
createException
in interfaceExceptionMapping<T extends Throwable>
- Parameters:
message
- the error messagecause
- the exception cause- Returns:
- the new exception
-
createException
Description copied from interface:ExceptionMapping
Creates a new exception for the given server fault.- Specified by:
createException
in interfaceExceptionMapping<T extends Throwable>
- Parameters:
cause
- the exception cause- Returns:
- the new exception
-
getErrorCode
public com.lexmark.saperion.exceptions.ErrorCodeType getErrorCode()Description copied from interface:ExceptionMapping
Returns the error code this exception mapping applies to.- Specified by:
getErrorCode
in interfaceExceptionMapping<T extends Throwable>
- Returns:
- the exception mapping's error code
-
validate
public boolean validate()Description copied from interface:ExceptionMapping
Validates the integrity of the exception mapping. An exception mapping is valid if the mapped exception class can be instantiated and an appropriate factory constructor exists. Appropriate exception implementations must provide a factory constructors that consume anErrorType
and aThrowable
.- Specified by:
validate
in interfaceExceptionMapping<T extends Throwable>
- Returns:
true
if the mapping is valid and the mapped exception fits the design rules, otherwisefalse
-