From 318e8768d61b93a6a33d2f9e6d5f2d30941b4fc9 Mon Sep 17 00:00:00 2001 From: Vedran Pavic Date: Wed, 22 Mar 2023 22:55:07 +0100 Subject: [PATCH] Remove Lombok --- pom.xml | 12 --- .../javamessaging/SQSQueueDestination.java | 62 +++++++++++-- .../acknowledge/SQSMessageIdentifier.java | 89 ++++++++++++++++--- 3 files changed, 133 insertions(+), 30 deletions(-) diff --git a/pom.xml b/pom.xml index 1220274..fdde28d 100644 --- a/pom.xml +++ b/pom.xml @@ -35,11 +35,6 @@ - - org.projectlombok - lombok - 1.18.24 - software.amazon.awssdk sqs @@ -109,13 +104,6 @@ 17 17 UTF-8 - - - org.projectlombok - lombok - 1.18.24 - - diff --git a/src/main/java/com/amazon/sqs/javamessaging/SQSQueueDestination.java b/src/main/java/com/amazon/sqs/javamessaging/SQSQueueDestination.java index 4b8c00a..9e7fdfe 100644 --- a/src/main/java/com/amazon/sqs/javamessaging/SQSQueueDestination.java +++ b/src/main/java/com/amazon/sqs/javamessaging/SQSQueueDestination.java @@ -16,18 +16,12 @@ import jakarta.jms.Destination; import jakarta.jms.Queue; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.ToString; /** * A SQSQueueDestination object encapsulates a queue name and SQS specific queue * URL. This is the way a client specifies the identity of a queue to JMS API * methods. */ -@Getter -@ToString(exclude = {"isFifo"}) -@EqualsAndHashCode public class SQSQueueDestination implements Destination, Queue { private final String queueName; @@ -41,4 +35,60 @@ public class SQSQueueDestination implements Destination, Queue { this.queueUrl = queueUrl; this.isFifo = this.queueName.endsWith(".fifo"); } + + /** + * Returns the name of this queue. + * + * @return queueName + */ + @Override + public String getQueueName() { + return this.queueName; + } + + /** + * Returns the queueUrl of this queue. + * + * @return queueUrl + */ + public String getQueueUrl() { + return this.queueUrl; + } + + public boolean isFifo() { + return this.isFifo; + } + + @Override + public String toString() { + return "SQSDestination [queueName=" + queueName + ", queueUrl=" + queueUrl + "]"; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((queueName == null) ? 0 : queueName.hashCode()); + result = prime * result + ((queueUrl == null) ? 0 : queueUrl.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + SQSQueueDestination other = (SQSQueueDestination) obj; + if (queueName == null) { + if (other.queueName != null) + return false; + } else if (!queueName.equals(other.queueName)) + return false; + if (queueUrl == null) { + return other.queueUrl == null; + } else return queueUrl.equals(other.queueUrl); + } } diff --git a/src/main/java/com/amazon/sqs/javamessaging/acknowledge/SQSMessageIdentifier.java b/src/main/java/com/amazon/sqs/javamessaging/acknowledge/SQSMessageIdentifier.java index 1b9e522..b6b95e8 100644 --- a/src/main/java/com/amazon/sqs/javamessaging/acknowledge/SQSMessageIdentifier.java +++ b/src/main/java/com/amazon/sqs/javamessaging/acknowledge/SQSMessageIdentifier.java @@ -16,31 +16,19 @@ import com.amazon.sqs.javamessaging.message.SQSMessage; import jakarta.jms.JMSException; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.ToString; /** * Identifies an SQS message, when (negative)acknowledging the message */ -@ToString(onlyExplicitlyIncluded = true) -@EqualsAndHashCode(onlyExplicitlyIncluded = true) -@Getter public class SQSMessageIdentifier { // The queueUrl where the message was sent or received from - @ToString.Include - @EqualsAndHashCode.Include private final String queueUrl; // The receipt handle returned after the delivery of the message from SQS - @ToString.Include - @EqualsAndHashCode.Include private final String receiptHandle; // The SQS message id assigned on send. - @ToString.Include - @EqualsAndHashCode.Include private final String sqsMessageId; // The group id to which the message belongs @@ -63,4 +51,81 @@ public SQSMessageIdentifier(String queueUrl, String receiptHandle, String sqsMes public static SQSMessageIdentifier fromSQSMessage(SQSMessage sqsMessage) throws JMSException { return new SQSMessageIdentifier(sqsMessage.getQueueUrl(), sqsMessage.getReceiptHandle(), sqsMessage.getSQSMessageId(), sqsMessage.getSQSMessageGroupId()); } + + /** + * Returns the queueUrl where the message was sent or received from. + * + * @return queueUrl + */ + public String getQueueUrl() { + return this.queueUrl; + } + + /** + * Returns the receipt handle returned after the delivery of the message + * from SQS. + * + * @return receiptHandle + */ + public String getReceiptHandle() { + return this.receiptHandle; + } + + /** + * Returns the SQS message id assigned on send. + * + * @return sqsMessageId + */ + public String getSQSMessageID() { + return this.sqsMessageId; + } + + /** + * Returns the group id to which the message belongs. Non-null only for messages received from FIFO queues. + * + * @return groupId + */ + public String getGroupId() { + return this.groupId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((queueUrl == null) ? 0 : queueUrl.hashCode()); + result = prime * result + ((receiptHandle == null) ? 0 : receiptHandle.hashCode()); + result = prime * result + ((sqsMessageId == null) ? 0 : sqsMessageId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + SQSMessageIdentifier other = (SQSMessageIdentifier) obj; + if (queueUrl == null) { + if (other.queueUrl != null) + return false; + } else if (!queueUrl.equals(other.queueUrl)) + return false; + if (receiptHandle == null) { + if (other.receiptHandle != null) + return false; + } else if (!receiptHandle.equals(other.receiptHandle)) + return false; + if (sqsMessageId == null) { + return other.sqsMessageId == null; + } else return sqsMessageId.equals(other.sqsMessageId); + } + + @Override + public String toString() { + return "SQSMessageIdentifier [queueUrl=" + queueUrl + ", receiptHandle=" + receiptHandle + + ", sqsMessageId=" + sqsMessageId + "]"; + } }