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 Details

    • EcmsExceptionMapping

      public EcmsExceptionMapping(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.
      Parameters:
      errorCode - the error code
      exception - the exception class
  • Method Details

    • createException

      public T createException(com.lexmark.saperion.exceptions.ErrorType fault, Throwable cause)
      Description copied from interface: ExceptionMapping
      Creates a new exception for the given server fault.
      Specified by:
      createException in interface ExceptionMapping<T extends Throwable>
      Parameters:
      fault - the server error
      cause - the exception cause
      Returns:
      the new exception
    • createException

      public T createException(String message)
      Description copied from interface: ExceptionMapping
      Creates a new exception for the given server fault.
      Specified by:
      createException in interface ExceptionMapping<T extends Throwable>
      Parameters:
      message - the error message
      Returns:
      the new exception
    • createException

      public T createException(String message, Throwable cause)
      Description copied from interface: ExceptionMapping
      Creates a new exception for the given server fault.
      Specified by:
      createException in interface ExceptionMapping<T extends Throwable>
      Parameters:
      message - the error message
      cause - the exception cause
      Returns:
      the new exception
    • createException

      public T createException(Throwable cause)
      Description copied from interface: ExceptionMapping
      Creates a new exception for the given server fault.
      Specified by:
      createException in interface ExceptionMapping<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 interface ExceptionMapping<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 an ErrorType and a Throwable.
      Specified by:
      validate in interface ExceptionMapping<T extends Throwable>
      Returns:
      true if the mapping is valid and the mapped exception fits the design rules, otherwise false