Package com.jk.core.exceptions.handler
Class JKExceptionHandlerFactory
java.lang.Object
com.jk.core.exceptions.handler.JKExceptionHandlerFactory
This class is a factory used to create 
JKExceptionHandler objects.
 This class provides the necessary methods needed to create the objects and specify their types and attributes.
- Version:
 - 1.0
 - Author:
 - Dr. Jalal H. Kiswani
 
- 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionThis method gets the default exception handler.getHandler(Class<? extends Throwable> clas) This method gets a suitable exception handler depending on the specified throwable.<T extends Throwable>
JKExceptionHandlerInfogetHandler(T t) This method gets a suitable exception handler depending on a custom throwable class object of typeT.static JKExceptionHandlerFactoryThis method gets the single instance ofJKExceptionHandlerFactory.static voidThis main method registers the handlers in the annotation package and gives handle anIOExceptionwith a custom message for testing purposes.voidregisterHandlers(String packageString) This method registers the handlers within the specifies package.voidsetDefaultExceptionHandler(JKExceptionHandler defaultExceptionHandler) This method replaces the current default exception handler.voidsetHandler(Class<? extends Throwable> clas, JKExceptionHandler handler) This method adds the specified handler and its associated throwable to the list of handlers of this factory. 
- 
Constructor Details
- 
JKExceptionHandlerFactory
public JKExceptionHandlerFactory() 
 - 
 - 
Method Details
- 
getInstance
This method gets the single instance ofJKExceptionHandlerFactory.if no instance been initiated yet, it initiate a new one then returns it.
- Returns:
 - single instance of JKExceptionHandlerFactory
 
 - 
getDefaultHandler
This method gets the default exception handler.if no instance been initiated yet, it initiate a new one then returns it.
- Returns:
 - the default exception handler.
 
 - 
getHandler
This method gets a suitable exception handler depending on the specified throwable.- Parameters:
 clas- Specifies the throwable that the created handler should handle.- Returns:
 - a suitable exception handler.
 
 - 
getHandler
This method gets a suitable exception handler depending on a custom throwable class object of typeT.- Type Parameters:
 T- Specifies the generic type of the custom throwable object.- Parameters:
 t- Specifies the custom throwable object.- Returns:
 - a suitable exception handler.
 
 - 
setDefaultExceptionHandler
This method replaces the current default exception handler.- Parameters:
 defaultExceptionHandler- Represents the new default exception handler.
 - 
setHandler
This method adds the specified handler and its associated throwable to the list of handlers of this factory.- Parameters:
 clas- Specifies the throwable that the specified handler deals with.handler- Specifies the exception handler responsible for the specified throwable type.
 - 
registerHandlers
This method registers the handlers within the specifies package.- Parameters:
 packageString- Specifies the name of the package to search in.
 - 
main
This main method registers the handlers in the annotation package and gives handle anIOExceptionwith a custom message for testing purposes.- Parameters:
 args- Specifies the command line arguments.
 
 -