Class AbstractExceptionFactory<T extends Exception>
java.lang.Object
com.lexmark.saperion.exceptions.mappings.AbstractExceptionFactory<T>
- Type Parameters:
T
- the exception type supported by the factory
- All Implemented Interfaces:
ExceptionFactory<T>
- Direct Known Subclasses:
ApplicationExceptionFactory
,RuntimeExceptionFactory
,SystemExceptionFactory
public abstract class AbstractExceptionFactory<T extends Exception>
extends Object
implements ExceptionFactory<T>
Base implementation of an exception factory. Exception factories provide the basic functionality to instantiate ECM
Service exceptions based on a server fault. Server faults are representations of server errors that are send over the
wire.
An exception factory instantiates the ECM Service exceptions based on the server fault error code and the factory's
internal exception mapping. Only if the factory has an exception mapping for the server error code it can instantiate
the appropriate exception for a server fault.
Concrete exception factories must implement the
getExceptionMappings()
method. This method returns all
exception mappings registered with this factory.- Author:
- owaeldrich
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.lexmark.saperion.exceptions.mappings.ExceptionFactory
ExceptionFactory.IntegrityCheckResult
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionPerforms an integrity check on the factories exception mapping registries.createException
(com.lexmark.saperion.exceptions.ErrorType fault, Throwable cause) This method creates a new exception instance for the given server fault.protected abstract ExceptionMapping<T>[]
This method returns all exception mappings registered with this factory.Set<com.lexmark.saperion.exceptions.ErrorCodeType>
Returns the supported error codes for this factory instance.boolean
supports
(com.lexmark.saperion.exceptions.ErrorCodeType errorCode) This method determines if an exception mapping for faults with the given error code exists in the factory instance.valueOf
(com.lexmark.saperion.exceptions.ErrorCodeType code) Returns the exception mapping for this error code.
-
Constructor Details
-
AbstractExceptionFactory
public AbstractExceptionFactory()
-
-
Method Details
-
createException
Description copied from interface:ExceptionFactory
This method creates a new exception instance for the given server fault.- Specified by:
createException
in interfaceExceptionFactory<T extends Exception>
- Parameters:
fault
- the server error representationcause
- the exception cause- Returns:
- the exception instance for the given server error
-
getSupportedErrors
Returns the supported error codes for this factory instance.- Returns:
- the factory's supported error codes
-
supports
public boolean supports(com.lexmark.saperion.exceptions.ErrorCodeType errorCode) Description copied from interface:ExceptionFactory
This method determines if an exception mapping for faults with the given error code exists in the factory instance. Therefore, the exception factory searches its internal exception mappings whether a mapping for the given error code exists or not.- Specified by:
supports
in interfaceExceptionFactory<T extends Exception>
- Parameters:
errorCode
- the server error code- Returns:
- the exception instance for the given server fault
-
valueOf
Returns the exception mapping for this error code. If there is no exception mapping with the given error code registered with this factory the method returns null.- Parameters:
code
- the error code to retrieve a mapping for- Returns:
- the exception mapping for the given error code, or null if no such mapping exists in this factory
-
getExceptionMappings
This method returns all exception mappings registered with this factory. Concrete exception factories must implement this method.- Returns:
- all exception mappings registered with this factory
-
checkIntegrity
Description copied from interface:ExceptionFactory
Performs an integrity check on the factories exception mapping registries.- Specified by:
checkIntegrity
in interfaceExceptionFactory<T extends Exception>
- Returns:
- the integrity check result
-