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 anEcmException
class.- 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 T
createException(com.lexmark.saperion.exceptions.ErrorType fault, java.lang.Throwable cause)
Creates a new exception for the given server fault.T
createException(java.lang.String message)
Creates a new exception for the given server fault.T
createException(java.lang.String message, java.lang.Throwable cause)
Creates a new exception for the given server fault.T
createException(java.lang.Throwable cause)
Creates a new exception for the given server fault.com.lexmark.saperion.exceptions.ErrorCodeType
getErrorCode()
Returns the error code this exception mapping applies to.boolean
validate()
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:ExceptionMapping
Creates a new exception for the given server fault.- Specified by:
createException
in 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:ExceptionMapping
Creates a new exception for the given server fault.- Specified by:
createException
in 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:ExceptionMapping
Creates a new exception for the given server fault.- Specified by:
createException
in 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:ExceptionMapping
Creates a new exception for the given server fault.- Specified by:
createException
in 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:ExceptionMapping
Returns the error code this exception mapping applies to.- Specified by:
getErrorCode
in interfaceExceptionMapping<T extends java.lang.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 java.lang.Throwable>
- Returns:
true
if the mapping is valid and the mapped exception fits the design rules, otherwisefalse
-
-