Class AbstractExceptionFactory<T extends java.lang.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 java.lang.Exception> extends java.lang.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 thegetExceptionMappings()
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 Constructor Description AbstractExceptionFactory()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description ExceptionFactory.IntegrityCheckResult
checkIntegrity()
Performs an integrity check on the factories exception mapping registries.T
createException(com.lexmark.saperion.exceptions.ErrorType fault, java.lang.Throwable cause)
This method creates a new exception instance for the given server fault.protected abstract ExceptionMapping<T>[]
getExceptionMappings()
This method returns all exception mappings registered with this factory.java.util.Set<com.lexmark.saperion.exceptions.ErrorCodeType>
getSupportedErrors()
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.ExceptionMapping<T>
valueOf(com.lexmark.saperion.exceptions.ErrorCodeType code)
Returns the exception mapping for this error code.
-
-
-
Method Detail
-
createException
public T createException(com.lexmark.saperion.exceptions.ErrorType fault, java.lang.Throwable cause)
Description copied from interface:ExceptionFactory
This method creates a new exception instance for the given server fault.- Specified by:
createException
in interfaceExceptionFactory<T extends java.lang.Exception>
- Parameters:
fault
- the server error representationcause
- the exception cause- Returns:
- the exception instance for the given server error
-
getSupportedErrors
public java.util.Set<com.lexmark.saperion.exceptions.ErrorCodeType> 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 java.lang.Exception>
- Parameters:
errorCode
- the server error code- Returns:
- the exception instance for the given server fault
-
valueOf
public ExceptionMapping<T> valueOf(com.lexmark.saperion.exceptions.ErrorCodeType code)
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
protected abstract ExceptionMapping<T>[] 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
public ExceptionFactory.IntegrityCheckResult checkIntegrity()
Description copied from interface:ExceptionFactory
Performs an integrity check on the factories exception mapping registries.- Specified by:
checkIntegrity
in interfaceExceptionFactory<T extends java.lang.Exception>
- Returns:
- the integrity check result
-
-