From 80566242498c301a8293015b57550886e51e00e7 Mon Sep 17 00:00:00 2001 From: delvh Date: Wed, 25 Mar 2020 17:43:55 +0100 Subject: [PATCH] refactored all `getId()`s to `getID()`s --- src/main/java/envoy/data/Contacts.java | 2 +- src/main/java/envoy/data/Message.java | 22 ++++++++-------- src/main/java/envoy/data/MessageBuilder.java | 26 +++++++++---------- .../java/envoy/event/GroupResizeEvent.java | 5 ++-- .../envoy/event/MessageStatusChangeEvent.java | 4 +-- .../envoy/event/UserStatusChangeEvent.java | 2 +- src/main/java/module-info.java | 2 +- 7 files changed, 32 insertions(+), 31 deletions(-) diff --git a/src/main/java/envoy/data/Contacts.java b/src/main/java/envoy/data/Contacts.java index c86c1fc..fb7f866 100644 --- a/src/main/java/envoy/data/Contacts.java +++ b/src/main/java/envoy/data/Contacts.java @@ -15,7 +15,7 @@ public class Contacts implements Serializable { private final List contacts; - private static final long serialVersionUID = 136970804968152871L; + private static final long serialVersionUID = 0L; /** * Creates an instance of {@link Contacts}. diff --git a/src/main/java/envoy/data/Message.java b/src/main/java/envoy/data/Message.java index ab26c9a..ff9a453 100644 --- a/src/main/java/envoy/data/Message.java +++ b/src/main/java/envoy/data/Message.java @@ -48,7 +48,7 @@ public class Message implements Serializable { READ } - private final long id, senderId, recipientId; + private final long id, senderID, recipientID; private final boolean forwarded; private final Date creationDate; private final String text; @@ -66,8 +66,8 @@ public class Message implements Serializable { * properties. * * @param id unique ID - * @param senderId the ID of the user who sends the message - * @param recipientId the ID of the user who receives the message + * @param senderID the ID of the user who sends the message + * @param recipientID the ID of the user who receives the message * @param creationDate the creation date of the message * @param text the text content of the message * @param attachment the attachment of the message, if present @@ -75,11 +75,11 @@ public class Message implements Serializable { * @param forwarded whether this message was forwarded * @since Envoy Common v0.2-alpha */ - Message(long id, long senderId, long recipientId, Date creationDate, String text, MessageAttachment attachment, MessageStatus status, + Message(long id, long senderID, long recipientID, Date creationDate, String text, MessageAttachment attachment, MessageStatus status, boolean forwarded) { this.id = id; - this.senderId = senderId; - this.recipientId = recipientId; + this.senderID = senderID; + this.recipientID = recipientID; this.creationDate = creationDate; this.text = text; this.attachment = attachment; @@ -110,8 +110,8 @@ public class Message implements Serializable { return String.format( "TextMessage[id=%d,sender=%s,recipient=%s,date=%s,status=%s,text=%s,forwarded,hasAttachment=%b]", id, - senderId, - recipientId, + senderID, + recipientID, new SimpleDateFormat("dd.MM.yyyy HH:mm:ss").format(creationDate), status, text, @@ -123,19 +123,19 @@ public class Message implements Serializable { * @return the ID of this message * @since Envoy Common v0.2-alpha */ - public long getId() { return id; } + public long getID() { return id; } /** * @return the sender ID of this message * @since Envoy Common v0.2-alpha */ - public long getSenderId() { return senderId; } + public long getSenderID() { return senderID; } /** * @return the recipient ID of this message * @since Envoy Common v0.2-alpha */ - public long getRecipientId() { return recipientId; } + public long getRecipientID() { return recipientID; } /** * @return the date at which this message was created diff --git a/src/main/java/envoy/data/MessageBuilder.java b/src/main/java/envoy/data/MessageBuilder.java index 3ee6ec5..c23f663 100644 --- a/src/main/java/envoy/data/MessageBuilder.java +++ b/src/main/java/envoy/data/MessageBuilder.java @@ -17,7 +17,7 @@ import envoy.data.Message.MessageStatus; public class MessageBuilder { // Mandatory properties without default values - private final long senderId, recipientId; + private final long senderID, recipientID; // Properties with default values private long id; @@ -31,26 +31,26 @@ public class MessageBuilder { * Creates an instance of {@link MessageBuilder} with all mandatory values * without defaults for the {@link Message} class. * - * @param senderId the ID of the user who sends the {@link Message} - * @param recipientId the ID of the user who receives the {@link Message} + * @param senderID the ID of the user who sends the {@link Message} + * @param recipientID the ID of the user who receives the {@link Message} * @param iDGenerator the ID generator used to generate a unique {@link Message} * id * @since Envoy Common v0.2-alpha */ - public MessageBuilder(long senderId, long recipientId, IDGenerator iDGenerator) { this(senderId, recipientId, iDGenerator.next()); } + public MessageBuilder(long senderID, long recipientID, IDGenerator iDGenerator) { this(senderID, recipientID, iDGenerator.next()); } /** * Creates an instance of {@link MessageBuilder} with all mandatory values * without defaults for the {@link Message} class. * - * @param senderId the ID of the user who sends the {@link Message} - * @param recipientId the ID of the user who receives the {@link Message} + * @param senderID the ID of the user who sends the {@link Message} + * @param recipientID the ID of the user who receives the {@link Message} * @param messageId the ID of the {@link Message} * @since Envoy Common v0.2-alpha */ - public MessageBuilder(long senderId, long recipientId, long messageId) { - this.senderId = senderId; - this.recipientId = recipientId; + public MessageBuilder(long senderID, long recipientID, long messageId) { + this.senderID = senderID; + this.recipientID = recipientID; id = messageId; } @@ -60,13 +60,13 @@ public class MessageBuilder { * This makes it especially useful in the case of forwarding messages. * * @param msg the message to copy - * @param recipientId the ID of the user who receives the {@link Message} + * @param recipientID the ID of the user who receives the {@link Message} * @param iDGenerator the ID generator used to generate a unique {@link Message} * id * @since Envoy v0.1-beta */ - public MessageBuilder(Message msg, long recipientId, IDGenerator iDGenerator) { - this(msg.getRecipientId(), recipientId, iDGenerator.next()); + public MessageBuilder(Message msg, long recipientID, IDGenerator iDGenerator) { + this(msg.getRecipientID(), recipientID, iDGenerator.next()); this.attachment = msg.getAttachment(); this.creationDate = new Date(); this.forwarded = true; @@ -102,7 +102,7 @@ public class MessageBuilder { if (text == null) text = ""; if (status == null) status = MessageStatus.WAITING; - return new Message(id, senderId, recipientId, creationDate, text, attachment, status, forwarded); + return new Message(id, senderID, recipientID, creationDate, text, attachment, status, forwarded); } /** diff --git a/src/main/java/envoy/event/GroupResizeEvent.java b/src/main/java/envoy/event/GroupResizeEvent.java index e898752..8ad2ce5 100644 --- a/src/main/java/envoy/event/GroupResizeEvent.java +++ b/src/main/java/envoy/event/GroupResizeEvent.java @@ -7,7 +7,8 @@ import envoy.data.User; /** * This event is used to communicate changes in the group size between client * and server.
- * Possible actions are adding or removing certain {@link User}s to or from a certain {@link Group} + * Possible actions are adding or removing certain {@link User}s to or from a + * certain {@link Group} *
* Project: envoy-common
* File: GroupResizeEvent.java
@@ -93,4 +94,4 @@ public class GroupResizeEvent extends Event { */ @Override public String toString() { return String.format("GroupResizeEvent[userid=%d,groupid=%d,operationType=%b]", get(), groupID, operationType); } -} \ No newline at end of file +} diff --git a/src/main/java/envoy/event/MessageStatusChangeEvent.java b/src/main/java/envoy/event/MessageStatusChangeEvent.java index 0307e6e..2068c7f 100644 --- a/src/main/java/envoy/event/MessageStatusChangeEvent.java +++ b/src/main/java/envoy/event/MessageStatusChangeEvent.java @@ -40,13 +40,13 @@ public class MessageStatusChangeEvent extends Event { * @param message the message from which to build the event * @since Envoy Common v0.2-alpha */ - public MessageStatusChangeEvent(Message message) { this(message.getId(), message.getStatus(), new Date()); } + public MessageStatusChangeEvent(Message message) { this(message.getID(), message.getStatus(), new Date()); } /** * @return the ID of the {@link Message} this event is related to * @since Envoy Common v0.2-alpha */ - public long getId() { return id; } + public long getID() { return id; } /** * @return the date at which the status change occurred diff --git a/src/main/java/envoy/event/UserStatusChangeEvent.java b/src/main/java/envoy/event/UserStatusChangeEvent.java index 8ab198c..2a85676 100644 --- a/src/main/java/envoy/event/UserStatusChangeEvent.java +++ b/src/main/java/envoy/event/UserStatusChangeEvent.java @@ -42,7 +42,7 @@ public class UserStatusChangeEvent extends Event { * @return the ID of the {@link User} this event is related to * @since Envoy Common v0.2-alpha */ - public long getId() { return id; } + public long getID() { return id; } @Override public String toString() { return String.format("UserStatusChangeEvent[id=%d,status=%s]", id, value); } diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index 5cfe504..ac8ee44 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -15,4 +15,4 @@ module envoy.common { exports envoy.event; requires transitive java.logging; -} \ No newline at end of file +}