summaryrefslogtreecommitdiff
path: root/src/main/java/design/model/Golfer.java
diff options
context:
space:
mode:
authorsowgro <tpoke.ferrari@gmail.com>2025-10-03 00:31:02 -0400
committersowgro <tpoke.ferrari@gmail.com>2025-10-03 00:31:02 -0400
commitd982cfe8a22ec7eb89186fed875a483a51c3505f (patch)
treed10d6215f2d47b3dae48a67b002c878b339d4599 /src/main/java/design/model/Golfer.java
parentd7249ab93dad3ba9be0389f402c1378d7f1eb5ad (diff)
downloaddesignproject-design-6-d982cfe8a22ec7eb89186fed875a483a51c3505f.tar.gz
designproject-design-6-d982cfe8a22ec7eb89186fed875a483a51c3505f.tar.bz2
designproject-design-6-d982cfe8a22ec7eb89186fed875a483a51c3505f.zip
Add code to handle id serialization
Diffstat (limited to 'src/main/java/design/model/Golfer.java')
-rw-r--r--src/main/java/design/model/Golfer.java17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/main/java/design/model/Golfer.java b/src/main/java/design/model/Golfer.java
index 8f09067..1a6c7b6 100644
--- a/src/main/java/design/model/Golfer.java
+++ b/src/main/java/design/model/Golfer.java
@@ -7,15 +7,24 @@ public class Golfer {
private String username;
private int passwordHash;
private String fullName;
- private final transient List<Course> courses; // might be better to make this like a courseID or something
+ private final List<Course> courses;
private final List<Round> rounds;
+ // for deserialization
+ public Golfer(String username, int passwordHash, String fullName, List<Course> courses, List<Round> rounds) {
+ this.username = username;
+ this.passwordHash = passwordHash;
+ this.fullName = fullName;
+ this.courses = courses;
+ this.rounds = rounds;
+ }
+
public Golfer(String fullName, String username, String password) {
- this.courses = new ArrayList<>();
- this.rounds = new ArrayList<>();
this.fullName = fullName;
this.username = username;
this.passwordHash = password.hashCode();
+ this.courses = new ArrayList<>();
+ this.rounds = new ArrayList<>();
}
public String getUsername() {
@@ -61,6 +70,4 @@ public class Golfer {
public void addRound(Round round) {
rounds.add(round);
}
-
-
}