refactor: make factory class constructor private

This commit is contained in:
seahi 2024-12-18 08:59:14 +08:00
parent 5c525d9c32
commit 669522ba58
2 changed files with 14 additions and 0 deletions

View File

@ -12,6 +12,13 @@ public class DAOFactory {
private static final TeacherDAO teacherDAO = new TeacherDAOImpl();
private static final LeaveRequestDAO leaveRequestDAO = new LeaveRequestDAOImpl();
/**
* 私有构造函数防止实例化
*/
private DAOFactory() {
// 私有构造函数阻止实例化
}
/**
* 获取StudentDAO实例
* @return StudentDAO实例

View File

@ -8,6 +8,13 @@ public class ServiceFactory {
private static final TeacherService teacherService = new TeacherService();
private static final LeaveRequestService leaveRequestService = new LeaveRequestService();
/**
* 私有构造函数防止实例化
*/
private ServiceFactory() {
// 私有构造函数阻止实例化
}
/**
* 获取StudentService实例
* @return StudentService实例