Class EcmsExceptionMapping<T extends java.lang.Throwable>

  • 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 an EcmException 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 code
        exception - 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 interface ExceptionMapping<T extends java.lang.Throwable>
        Parameters:
        fault - the server error
        cause - 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 interface ExceptionMapping<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 interface ExceptionMapping<T extends java.lang.Throwable>
        Parameters:
        message - the error message
        cause - 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 interface ExceptionMapping<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 interface ExceptionMapping<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 an ErrorType and a Throwable.
        Specified by:
        validate in interface ExceptionMapping<T extends java.lang.Throwable>
        Returns:
        true if the mapping is valid and the mapped exception fits the design rules, otherwise false