thespeedracer38

FileHandlerFactory

Apr 11th, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.57 KB | None | 0 0
  1. /**
  2.  *
  3.  * @author Ranajoy
  4.  */
  5. public class FileHandlerFactory {
  6.     // Return the correct FileHandler according to type
  7.     static FileHandler getHandler(String type){
  8.         FileHandler myFileHandler = null;
  9.         if("pdf".equalsIgnoreCase(type)){
  10.             myFileHandler = new PDFHandler();
  11.         }
  12.         else if("html".equalsIgnoreCase(type)){
  13.             myFileHandler = new HTMLHandler();
  14.         }
  15.         else if("doc".equalsIgnoreCase(type)){
  16.             myFileHandler = new WordDocumentHandler();
  17.         }
  18.         return myFileHandler;
  19.     }
  20. }
Add Comment
Please, Sign In to add comment