From: Kai Moritz Date: Wed, 28 Dec 2022 16:23:30 +0000 (+0100) Subject: refactor: Refined field-names of `Message` and `MessageTo` X-Git-Tag: wip~94 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=e5da0c626f508cfae48bad543c9afe1090f39a9a;p=demos%2Fkafka%2Fchat refactor: Refined field-names of `Message` and `MessageTo` - Choosed longer and more descriptive field-names for the domain-class `Message`. - Choosed short names for the TO-class `MessageTO`, which is serialized as JSON. --- diff --git a/src/main/java/de/juplo/kafka/chat/backend/api/ChatBackendControllerAdvice.java b/src/main/java/de/juplo/kafka/chat/backend/api/ChatBackendControllerAdvice.java index d164fb5a..fb9c0f23 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/api/ChatBackendControllerAdvice.java +++ b/src/main/java/de/juplo/kafka/chat/backend/api/ChatBackendControllerAdvice.java @@ -40,7 +40,7 @@ public class ChatBackendControllerAdvice stringBuilder.setLength(0); stringBuilder.append("The existing message with user="); - stringBuilder.append(e.getExisting().getUser()); + stringBuilder.append(e.getExisting().getUsername()); stringBuilder.append(" and id="); stringBuilder.append(e.getExisting().getId()); stringBuilder.append(" cannot be mutated!"); diff --git a/src/main/java/de/juplo/kafka/chat/backend/api/MessageTo.java b/src/main/java/de/juplo/kafka/chat/backend/api/MessageTo.java index 7c72873e..53d2319a 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/api/MessageTo.java +++ b/src/main/java/de/juplo/kafka/chat/backend/api/MessageTo.java @@ -12,8 +12,8 @@ import java.time.LocalDateTime; public class MessageTo { private Long id; - private Long serialNumber; - private LocalDateTime timestamp; + private Long serial; + private LocalDateTime time; private String user; private String text; @@ -24,7 +24,7 @@ public class MessageTo message.getId(), message.getSerialNumber(), message.getTimestamp(), - message.getUser(), - message.getText()); + message.getUsername(), + message.getMessageText()); } } diff --git a/src/main/java/de/juplo/kafka/chat/backend/domain/Message.java b/src/main/java/de/juplo/kafka/chat/backend/domain/Message.java index d52ce8a1..c5b738f1 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/domain/Message.java +++ b/src/main/java/de/juplo/kafka/chat/backend/domain/Message.java @@ -17,6 +17,6 @@ public class Message private final Long id; private final Long serialNumber; private final LocalDateTime timestamp; - private final String user; - private final String text; + private final String username; + private final String messageText; }