So I have been looking through some code I wrote a few years ago for an economic simulation program. Each simulation has a large number of settings that can be saved to a file and later loaded back into the program to re-run the same/similar simulation. Some of the settings are optional or depend on what is being simulated. The code to read back the parameters is basically one very large switch statement (with a few nested switch statements). I was wondering if there is a better way to handle this situation. One line of the settings file might look like this:#RA:1,MT:DiscriminatoryPriceKDoubleAuction,OF:Demo Output.csv,QM:100,NT:5000,KP:0.5 //continues...And some of the code that would read that line:switch( Character.toUpperCase( s.charAt(0) ) ){    case 'R':         randSeed = Integer.valueOf( s.substring(3).trim() );         break;    case 'M':          marketType = s.substring(3).trim();          System.err.println(MarketType:  + marketType);          break;    case 'O':          outputFileName = s.substring(3).trim() ;          break;    case 'Q':          quantityOfMarkets = Integer.valueOf( s.substring(3).trim() );          break;    case 'N':          maxTradesPerRound = Integer.valueOf( s.substring(3).trim() );          break;    case 'K':          kParameter = Float.valueOf( s.substring(3).trim() );          break; // continues...}
What is the best practice for reading a large number of custom settings from a text file?
java;file handling