Changes for Checkstyle 8.32
[policy/models.git] / models-interactions / model-impl / appc / src / main / java / org / onap / policy / appc / Response.java
index d5fc66e..3afbd53 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * appc
  * ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
  * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
 package org.onap.policy.appc;
 
 import com.google.gson.annotations.SerializedName;
-
 import java.io.Serializable;
 import java.util.HashMap;
 import java.util.Map;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.Setter;
 
+@Getter
+@Setter
+@EqualsAndHashCode
 public class Response implements Serializable {
 
     private static final long serialVersionUID = 434953706339865151L;
@@ -34,11 +39,16 @@ public class Response implements Serializable {
     @SerializedName("CommonHeader")
     private CommonHeader commonHeader;
 
+    /**
+     * This should only be populated if the incoming message actually has a "Status"
+     * field. Otherwise, actor.appc will be unable to use this to distinguish between
+     * Request and Response objects.
+     */
     @SerializedName("Status")
-    private ResponseStatus status = new ResponseStatus();
+    private ResponseStatus status;
 
     @SerializedName("Payload")
-    private HashMap<String, Object> payload = new HashMap<>();
+    private Map<String, Object> payload = new HashMap<>();
 
     public Response() {
 
@@ -58,80 +68,8 @@ public class Response implements Serializable {
         }
     }
 
-    public CommonHeader getCommonHeader() {
-        return commonHeader;
-    }
-
-    public void setCommonHeader(CommonHeader commonHeader) {
-        this.commonHeader = commonHeader;
-    }
-
-    public ResponseStatus getStatus() {
-        return status;
-    }
-
-    public void setStatus(ResponseStatus status) {
-        this.status = status;
-    }
-
-    public Map<String, Object> getPayload() {
-        return payload;
-    }
-
-    public void setPayload(Map<String, Object> payload) {
-        this.payload = new HashMap<>(payload);
-    }
-
     @Override
     public String toString() {
         return "Response [CommonHeader=" + commonHeader + ", Status=" + status + ", Payload=" + payload + "]";
     }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + ((commonHeader == null) ? 0 : commonHeader.hashCode());
-        result = prime * result + ((payload == null) ? 0 : payload.hashCode());
-        result = prime * result + ((status == null) ? 0 : status.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;
-        }
-        Response other = (Response) obj;
-        if (commonHeader == null) {
-            if (other.commonHeader != null) {
-                return false;
-            }
-        } else if (!commonHeader.equals(other.commonHeader)) {
-            return false;
-        }
-        if (payload == null) {
-            if (other.payload != null) {
-                return false;
-            }
-        } else if (!payload.equals(other.payload)) {
-            return false;
-        }
-        if (status == null) {
-            if (other.status != null) {
-                return false;
-            }
-        } else if (!status.equals(other.status)) {
-            return false;
-        }
-        return true;
-    }
-
-
 }