Files
coursera-ibm-java-developer…/PetCareScheduler/src/main/java/Appointment.java

67 lines
1.6 KiB
Java

import java.time.LocalDate;
import java.time.LocalTime;
import static java.util.Objects.requireNonNull;
public final class Appointment {
private Type type;
private LocalDate date;
private LocalTime time;
private String notes;
public Appointment(Type type, LocalDate date, LocalTime time, String notes) {
this.type = requireNonNull(type, "Type must not be null");
this.date = requireNonNull(date, "date must not be null");
this.time = requireNonNull(time, "time must not be null");
this.notes = requireNonNull(notes, "note must not be null");
}
public Type getType() {
return type;
}
public LocalDate getDate() {
return date;
}
public LocalTime getTime() {
return time;
}
public String getNotes() {
return notes;
}
public void setType(Type type) {
this.type = requireNonNull(type, "Type must not be null");
}
public void setDate(LocalDate date) {
this.date = requireNonNull(date, "date must not be null");
}
public void setTime(LocalTime time) {
this.time = requireNonNull(time, "time must not be null");
}
public void setNotes(String notes) {
this.notes = requireNonNull(notes, "note must not be null");
}
@Override
public String toString() {
return "Appointment{" +
"type=" + type +
", date=" + date +
", time=" + time +
", notes='" + notes + '\'' +
'}';
}
public enum Type {
VET_VISIT,
VACCINATION,
GROOMING
}
}