From 8263a1355a11af6880d2a8614cc1701aa1596593 Mon Sep 17 00:00:00 2001 From: Lars Simon Winzer Date: Sun, 15 Mar 2026 18:22:11 +0100 Subject: [PATCH] Add: UserId to uniquely identify user --- .../casono/server/domain/user/UserId.java | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/main/java/ch/unibas/dmi/dbis/cs108/casono/server/domain/user/UserId.java diff --git a/src/main/java/ch/unibas/dmi/dbis/cs108/casono/server/domain/user/UserId.java b/src/main/java/ch/unibas/dmi/dbis/cs108/casono/server/domain/user/UserId.java new file mode 100644 index 0000000..c8e374e --- /dev/null +++ b/src/main/java/ch/unibas/dmi/dbis/cs108/casono/server/domain/user/UserId.java @@ -0,0 +1,31 @@ +package ch.unibas.dmi.dbis.cs108.casono.server.domain.user; + +import java.util.UUID; + +/** Represents a unique identifier for a user. */ +public class UserId { + private final UUID value; + + /** Creates a new UserId with a randomly generated UUID. */ + public UserId() { + this.value = UUID.randomUUID(); + } + + /** + * Creates a new UserId with the specified UUID. + * + * @param value the UUID to use for this UserId + */ + public UserId(UUID value) { + this.value = value; + } + + /** + * Returns the UUID value of this UserId. + * + * @return the UUID value + */ + public UUID value() { + return value; + } +}