From 0bfd2875fefacb42c777689452f0bf1cd0e1a64b Mon Sep 17 00:00:00 2001 From: fdai5728 Date: Wed, 16 Feb 2022 17:47:37 +0100 Subject: [PATCH] Rewrite ValueObject to DTO since we don't want to destroy the old object each time it gets updated --- src/main/java/Credential.java | 9 +++++---- src/main/java/CredentialRepository.java | 2 ++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/Credential.java b/src/main/java/Credential.java index b7b4fbd..506fdb7 100644 --- a/src/main/java/Credential.java +++ b/src/main/java/Credential.java @@ -1,9 +1,5 @@ public class Credential { - /** - * Value Object für das Tupel aus name + pw - */ - private String name, password; private int id; @@ -27,4 +23,9 @@ public class Credential { { this.password = newPassword; } + + public void updateUsername(String newUsername) + { + this.name = newUsername; + } } diff --git a/src/main/java/CredentialRepository.java b/src/main/java/CredentialRepository.java index 3fe9f97..7b5dab2 100644 --- a/src/main/java/CredentialRepository.java +++ b/src/main/java/CredentialRepository.java @@ -62,6 +62,8 @@ public class CredentialRepository implements CredentialRepositoryInterface{ @Override public void updatePassword(int index) { + + } public void updateUsername(int index){