aboutsummaryrefslogtreecommitdiffstats
path: root/core/core-protocols/src/main
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2021-08-03 14:08:09 -0400
committerJim Hahn <jrh3@att.com>2021-08-06 15:14:31 -0400
commit0ed6c16727aa92c93965a7da756536b113b262c8 (patch)
treef7961bccd0db40a9f9985a5936381f183432235c /core/core-protocols/src/main
parent9344ec1396b7151262e9b4ac48c72020e2b03e7e (diff)
Use lombok for apex-pdp #7
Updated thru core-protocols. Issue-ID: POLICY-3391 Change-Id: I2226fee16b276eba5c7f3fd1921a6cef36654f07 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'core/core-protocols/src/main')
-rw-r--r--core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/Message.java102
1 files changed, 13 insertions, 89 deletions
diff --git a/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/Message.java b/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/Message.java
index b79308e4a..005c181a0 100644
--- a/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/Message.java
+++ b/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/Message.java
@@ -22,6 +22,11 @@
package org.onap.policy.apex.core.protocols;
import java.io.Serializable;
+import lombok.AccessLevel;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
/**
@@ -29,8 +34,10 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
*
* @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com)
*/
+@Getter
+@ToString
+@EqualsAndHashCode
public abstract class Message implements Serializable {
- private static final int HASH_PRIME = 31;
// Serialization ID
private static final long serialVersionUID = 2271443377544488309L;
@@ -42,12 +49,17 @@ public abstract class Message implements Serializable {
private Action action = null;
// The artifact key of the artifact to which this message is related
+ @Getter(AccessLevel.NONE)
private AxArtifactKey targetKey = null;
// The data of the message
+ @Setter
private String messageData = null;
// The timeout time for replies in milliseconds
+ @Setter
+ @ToString.Exclude
+ @EqualsAndHashCode.Exclude
private int replyTimeout = DEFAULT_REPLY_TIMEOUT;
/**
@@ -74,24 +86,6 @@ public abstract class Message implements Serializable {
}
/**
- * Set the message timeout.
- *
- * @param replyTimeout the timeout on reply messages in milliseconds
- */
- public void setReplyTimeout(final int replyTimeout) {
- this.replyTimeout = replyTimeout;
- }
-
- /**
- * Sets the message data.
- *
- * @param messageData the new message data
- */
- public void setMessageData(final String messageData) {
- this.messageData = messageData;
- }
-
- /**
* Append to the message data.
*
* @param newMessageData the message data
@@ -121,74 +115,4 @@ public abstract class Message implements Serializable {
public final String getTargetName() {
return targetKey.getName();
}
-
- /**
- * Gets the action or message type of this message.
- *
- * @return the action
- */
- public final Action getAction() {
- return action;
- }
-
- /**
- * Gets the message data.
- *
- * @return the message data
- */
- public final String getMessageData() {
- return messageData;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public boolean equals(final Object object) {
- if (this == object) {
- return true;
- }
- if (object == null || getClass() != object.getClass()) {
- return false;
- }
-
- final Message message = (Message) object;
-
- if (action != null ? !action.equals(message.action) : message.action != null) {
- return false;
- }
- if (targetKey != null ? !targetKey.equals(message.targetKey) : message.targetKey != null) {
- return false;
- }
- return !(messageData != null ? !messageData.equals(message.messageData) : message.messageData != null);
-
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public int hashCode() {
- int result = action != null ? action.hashCode() : 0;
- result = HASH_PRIME * result + (targetKey != null ? targetKey.hashCode() : 0);
- result = HASH_PRIME * result + (messageData != null ? messageData.hashCode() : 0);
- return result;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public String toString() {
- return "Message [action=" + action + ", targetKey=" + targetKey + ", data=" + messageData + "]";
- }
-
- /**
- * Get the timeout to wait for a reply.
- *
- * @return the timeout in milliseconds
- */
- public int getReplyTimeout() {
- return replyTimeout;
- }
}