Class ApplicantList
- All Implemented Interfaces:
Saveable
Manages a list of
Applicant objects, handling data persistence and retrieval.
This class extends the generic ModelList to specialize in managing applicant data,
likely loaded from and saved to a CSV file specified by FILE_PATH.
It provides methods to access the list instance and retrieve applicants by their ID.
Uses a static factory method getInstance() for convenient access.-
Constructor Summary
ConstructorsConstructorDescriptionApplicantList(String filePath) Constructs an ApplicantList instance associated with a specific file path. -
Method Summary
Modifier and TypeMethodDescriptionRetrieves anApplicantfrom the list based on their unique user ID.Gets the file path associated with this ApplicantList instance, indicating where the applicant data is persisted.static ApplicantListProvides a static factory method to get an instance of ApplicantList.
-
Constructor Details
-
ApplicantList
Constructs an ApplicantList instance associated with a specific file path. Calls the superclass constructor to initialize the list, providing the file path and theApplicant.classtype for CSV data mapping. Typically accessed via the staticgetInstance()method using the default path.- Parameters:
filePath- The path to the CSV file used for data persistence.
-
-
Method Details
-
getInstance
Provides a static factory method to get an instance of ApplicantList. This method creates a new instance using the defaultFILE_PATH. Note: This implementation creates a new instance on each call, potentially reloading data. Consider implementing a true Singleton pattern if a single shared instance is desired.- Returns:
- A new instance of
ApplicantListinitialized with the default file path.
-
getFilePath
Gets the file path associated with this ApplicantList instance, indicating where the applicant data is persisted.- Specified by:
getFilePathin classModelList<Applicant>- Returns:
- The file path string (e.g., "data_csv/ApplicantList.csv").
-
getByID
Retrieves anApplicantfrom the list based on their unique user ID. Iterates through the list maintained by the superclass (ModelList.getAll()) and returns the first applicant matching the provided ID.
-