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.

69 lines
1.4 KiB

package com.library.model;
import java.util.ArrayList;
import java.util.List;
/**
* Member实体类
*/
public class Member {
private String memberId;
private String name;
private String email;
private List<Book> borrowedBooks;
public Member(String memberId, String name, String email) {
this.memberId = memberId;
this.name = name;
this.email = email;
this.borrowedBooks = new ArrayList<>();
}
// Getters and Setters
public String getMemberId() {
return memberId;
}
public void setMemberId(String memberId) {
this.memberId = memberId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public List<Book> getBorrowedBooks() {
return new ArrayList<>(borrowedBooks);
}
public void addBorrowedBook(Book book) {
this.borrowedBooks.add(book);
}
public void removeBorrowedBook(Book book) {
this.borrowedBooks.remove(book);
}
@Override
public String toString() {
return "Member{" +
"memberId='" + memberId + '\'' +
", name='" + name + '\'' +
", email='" + email + '\'' +
'}';
}
}