From 978c79d3ae900ab8dfb6ca7c3cf7fa9f3422b51e Mon Sep 17 00:00:00 2001 From: fdai5728 Date: Wed, 16 Feb 2022 16:48:46 +0100 Subject: [PATCH] Implements a Value Object to hold user information --- src/main/java/Credential.java | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/main/java/Credential.java diff --git a/src/main/java/Credential.java b/src/main/java/Credential.java new file mode 100644 index 0000000..702a60b --- /dev/null +++ b/src/main/java/Credential.java @@ -0,0 +1,30 @@ +public class Credential { + + /** + * Value Object für das Tupel aus name + pw + */ + + private String name, password; + private int id; + + + public Credential(String name, String password, int id) throws Exception { + if(name == null || password == null) + throw new Exception("kein leeres Objekt erstellen bliat"); + + this.name = name; + this.password = password; + } + + public String getName() + { + return this.name; + } + public String getPassword() { return this.password; } + public int getId() { return this.id; } + + public void upDatePassword(String newPassword) + { + this.password = newPassword; + } +}