Package sc2002.FCS1.grp2
Class CSVParser
Object
CSVParser
This class parses CSV files.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate <Decodable extends CSVDecodable>
ArrayList<Decodable> Generic method to parse various class types that extendsCSVDecodable(package private) ArrayList<Application> Parse each line, with special handling for CSV cells with list values.(package private) ArrayList<HDBManager> (package private) ArrayList<HDBOfficer> (package private) ArrayList<BTOProject> Parse all users, regardless of user type.
-
Field Details
-
path
The file directory path which the CSV files are expected to be in.
-
-
Constructor Details
-
CSVParser
CSVParser(String path) Use this constructor if you would like to parse CSV files in a non-default directory.- Parameters:
path- Direct path to directory that stores the CSV files relevant to this BTO application.
-
CSVParser
CSVParser()Use this constructor to parse CSVs as expected in default CSV file directory. Before compiling the project, place the CSV files in the sc2002.FCS1.grp2.files folder. After compilation, these files will be in the bin directory, files folder, along with the built class files. This constructor will automatically parse files based on this directory.
-
-
Method Details
-
parse
private <Decodable extends CSVDecodable> ArrayList<Decodable> parse(String path, Class<Decodable> type) Generic method to parse various class types that extendsCSVDecodable- Type Parameters:
Decodable- Only CSVDecodable types can be parsed/decoded to.- Parameters:
path- The path of the file.type- The expected type which the file should be decoded to.- Returns:
- the parsed/decoded content.
-
parseLine
Parse each line, with special handling for CSV cells with list values.- Parameters:
line- A CSV line.- Returns:
- a list of cells, of that line.
-
parseApplicants
-
parseManagers
ArrayList<HDBManager> parseManagers() -
parseOfficer
ArrayList<HDBOfficer> parseOfficer() -
parseProjects
ArrayList<BTOProject> parseProjects() -
parseEnquiries
-
parseApplications
ArrayList<Application> parseApplications() -
retrieveAllUsers
Parse all users, regardless of user type.- Returns:
- all user objects.
-