refactor: make factory class constructor private
This commit is contained in:
parent
5c525d9c32
commit
669522ba58
@ -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实例
|
||||
|
@ -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实例
|
||||
|
Loading…
x
Reference in New Issue
Block a user