Class EcmsExceptionMapping<T extends java.lang.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 java.lang.Throwable> extends java.lang.Object implements ExceptionMapping<T>
Base implementation of an exception mapping entry. An exception mapping entry associates an error code with anEcmExceptionclass.- Author:
- owaeldrich
-
-
Constructor Summary
Constructors Constructor Description EcmsExceptionMapping(com.lexmark.saperion.exceptions.ErrorConstantType errorCode, java.lang.Class<T> exception)Creates a new exception mapping entry with the given error code and the given exception class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TcreateException(com.lexmark.saperion.exceptions.ErrorType fault, java.lang.Throwable cause)Creates a new exception for the given server fault.TcreateException(java.lang.String message)Creates a new exception for the given server fault.TcreateException(java.lang.String message, java.lang.Throwable cause)Creates a new exception for the given server fault.TcreateException(java.lang.Throwable cause)Creates a new exception for the given server fault.com.lexmark.saperion.exceptions.ErrorCodeTypegetErrorCode()Returns the error code this exception mapping applies to.booleanvalidate()Validates the integrity of the exception mapping.
-
-
-
Constructor Detail
-
EcmsExceptionMapping
public EcmsExceptionMapping(com.lexmark.saperion.exceptions.ErrorConstantType errorCode, java.lang.Class<T> exception)Creates a new exception mapping entry with the given error code and the given exception class.- Parameters:
errorCode- the error codeexception- the exception class
-
-
Method Detail
-
createException
public T createException(com.lexmark.saperion.exceptions.ErrorType fault, java.lang.Throwable cause)
Description copied from interface:ExceptionMappingCreates a new exception for the given server fault.- Specified by:
createExceptionin interfaceExceptionMapping<T extends java.lang.Throwable>- Parameters:
fault- the server errorcause- the exception cause- Returns:
- the new exception
-
createException
public T createException(java.lang.String message)
Description copied from interface:ExceptionMappingCreates a new exception for the given server fault.- Specified by:
createExceptionin interfaceExceptionMapping<T extends java.lang.Throwable>- Parameters:
message- the error message- Returns:
- the new exception
-
createException
public T createException(java.lang.String message, java.lang.Throwable cause)
Description copied from interface:ExceptionMappingCreates a new exception for the given server fault.- Specified by:
createExceptionin interfaceExceptionMapping<T extends java.lang.Throwable>- Parameters:
message- the error messagecause- the exception cause- Returns:
- the new exception
-
createException
public T createException(java.lang.Throwable cause)
Description copied from interface:ExceptionMappingCreates a new exception for the given server fault.- Specified by:
createExceptionin interfaceExceptionMapping<T extends java.lang.Throwable>- Parameters:
cause- the exception cause- Returns:
- the new exception
-
getErrorCode
public com.lexmark.saperion.exceptions.ErrorCodeType getErrorCode()
Description copied from interface:ExceptionMappingReturns the error code this exception mapping applies to.- Specified by:
getErrorCodein interfaceExceptionMapping<T extends java.lang.Throwable>- Returns:
- the exception mapping's error code
-
validate
public boolean validate()
Description copied from interface:ExceptionMappingValidates 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 anErrorTypeand aThrowable.- Specified by:
validatein interfaceExceptionMapping<T extends java.lang.Throwable>- Returns:
trueif the mapping is valid and the mapped exception fits the design rules, otherwisefalse
-
-