In my program I need to create xls or xlsx files and the file type is chosen using an option in a property file.This is how we can switch xls and xlsx file type using java codeFor xls:Workbook workbook =  new XSSFWorkbook();For xlsx:Workbook workbook =  new HSSFWorkbook();And what I do is, for creating every file I check the variable which contains the file type option in property file.if(variable which contains the filetype option in properties has xls ){    Workbook workbook =  new XSSFWorkbook();}else{    Workbook workbook =  new HSSFWorkbook();}I am doing this for ever single files and our processes involves creation of lots of files.  There are also conditions for creating filename for these files.  Is there any way to fix a specific class(XSSFWorkbook|HSSFWorkbook) at the time of initialization of program and use it throughout the program instead of checking the condition for every file.  I thought of singleton pattern but it is use of single object not class.
Deciding between two class to be initialized to an interface at the time of initilization of a program; and using this settings throughout
java;design patterns