You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
MVC/DuplicateStudentException.java

35 lines
741 B

package com.studentmanagement.exception;
/**
* 重复学生异常
* 当尝试添加已存在ID的学生时抛出
*/
public class DuplicateStudentException extends Exception {
private String studentId;
/**
* 构造函数
* @param message 异常消息
* @param studentId 学生ID
*/
public DuplicateStudentException(String message, String studentId) {
super(message);
this.studentId = studentId;
}
/**
* 构造函数
* @param message 异常消息
*/
public DuplicateStudentException(String message) {
super(message);
}
/**
* 获取学生ID
* @return 学生ID
*/
public String getStudentId() {
return studentId;
}
}