Interface ExceptionMapping<T extends Throwable>

Type Parameters:
T - the mapped exception type
All Known Implementing Classes:
ApplicationExceptionFactory.ApplicationErrors, EcmsExceptionMapping, RuntimeExceptionFactory.RuntimeErrors, SystemExceptionFactory.SystemErrors

public interface ExceptionMapping<T extends Throwable>
An exception mapping associates an error code with a specific exception class. Error mappings are used by exception factories in order to build up the factories internal mapping registries.
Author:
owaeldrich
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    createException(com.lexmark.saperion.exceptions.ErrorType error, Throwable cause)
    Creates a new exception for the given server fault.
    Creates a new exception for the given server fault.
    createException(String message, Throwable cause)
    Creates a new exception for the given server fault.
    Creates a new exception for the given server fault.
    com.lexmark.saperion.exceptions.ErrorCodeType
    Returns the error code this exception mapping applies to.
    boolean
    Validates the integrity of the exception mapping.
  • Method Details

    • createException

      T createException(com.lexmark.saperion.exceptions.ErrorType error, Throwable cause)
      Creates a new exception for the given server fault.
      Parameters:
      error - the server error
      cause - the exception cause
      Returns:
      the new exception
    • createException

      T createException(String message)
      Creates a new exception for the given server fault.
      Parameters:
      message - the error message
      Returns:
      the new exception
    • createException

      T createException(String message, Throwable cause)
      Creates a new exception for the given server fault.
      Parameters:
      message - the error message
      cause - the exception cause
      Returns:
      the new exception
    • createException

      T createException(Throwable cause)
      Creates a new exception for the given server fault.
      Parameters:
      cause - the exception cause
      Returns:
      the new exception
    • getErrorCode

      com.lexmark.saperion.exceptions.ErrorCodeType getErrorCode()
      Returns the error code this exception mapping applies to.
      Returns:
      the exception mapping's error code
    • validate

      boolean validate()
      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 an ErrorType and a Throwable.
      Returns:
      true if the mapping is valid and the mapped exception fits the design rules, otherwise false