ref: 3642ff2c921852babc8be83d5614fbadd32a8818
dir: /Bookproj/BasicUser.java/
package Bookproj; import java.time.LocalDateTime; public class BasicUser { public boolean Active = false; protected Role role; protected String Username; protected int ID; protected LocalDateTime RegTime; /* we will use isEmpty, even if it's not init-ed */ private String Reserved = new String(); public BasicUser(Role r, String u, int id, LocalDateTime rt) { this.role = r; this.Username = u; this.ID = id; this.RegTime = rt; } Role getRole() { return this.role; } String getUsername() { return this.Username; } int getID() { return this.ID; } void clearReserved() { this.Reserved = ""; } void setReserved(String isbn) { /* ensure he has no books */ if (!this.getReserved().isEmpty() && !isbn.equals("")) throw new IllegalStateException("User already has a book!"); this.Reserved = isbn; } String getReserved() { return this.Reserved; } LocalDateTime getRegTime() { return this.RegTime; } }