EmployeeSalaries project reads CSV and JSON data and returns sum for each job title
Program takes as input list of file paths.
If no file paths are entered the program suggests paths to resource files inside jar.
Program accepts also path to files inside directory in which jar is residing.
Program based on file extension recognizes the type of algorithm it has to use: CSV or JSON.
Algorithm for CSV (CsvParser) has 1 implementation - utilizes Custom class composed of 2 Scanners
Algorithm for JSON (JsonParser) files has 2 implementations:
-
PARSE_EMPLOYEE_ARRAY_AS_WHOLE strategy (ParseStrategyEmployeeArrayAsWhole)
- This implementation utilizes fully Jackson's ObjectMapper
- benefits: using official implementation of jackson parser, faster
- drawbacks: more memory usage
- This implementation utilizes fully Jackson's ObjectMapper
-
PARSE_EMPLOYEE_ONE_BY_ONE strategy (ParseStrategyEmployeeOneByOne)
- This implementation utilizes also Jackson but in addition to that uses Scanner and Regular Expressions
- This allows for reading input file in chunks
- Each chunk is representing single Employee
- Then this chunk is parsed using Jackson's ObjectMapper
- And has its data extracted (data concerning this Employee's job(Title) and salary)
- Then only this extracted data is kept in HashArray of JobAverage(s)
- benefit: less memory usage, parsing employee and holding only job title and salary in memory,
- drawbacks: slower, not flexible (fe.: ParseStrategyEmployeeOneByOne.EMPLOYEES_ARRAY_FIELD_NAME = "employees")