Removing code smells
[dmaap/datarouter.git] / datarouter-prov / src / main / java / org / onap / dmaap / datarouter / provisioning / beans / FeedAuthorization.java
index 49578b8..fad6a33 100644 (file)
@@ -7,9 +7,9 @@
  * * Licensed under the Apache License, Version 2.0 (the "License");\r
  * * you may not use this file except in compliance with the License.\r
  * * You may obtain a copy of the License at\r
- * * \r
+ * *\r
  *  *      http://www.apache.org/licenses/LICENSE-2.0\r
- * * \r
+ * *\r
  *  * Unless required by applicable law or agreed to in writing, software\r
  * * distributed under the License is distributed on an "AS IS" BASIS,\r
  * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
@@ -25,6 +25,7 @@
 package org.onap.dmaap.datarouter.provisioning.beans;\r
 \r
 import java.util.HashSet;\r
+import java.util.Objects;\r
 import java.util.Set;\r
 \r
 import org.json.JSONArray;\r
@@ -32,65 +33,86 @@ import org.json.JSONObject;
 \r
 /**\r
  * The representation of a Feed authorization.  This encapsulates the authorization information about a feed.\r
+ *\r
  * @author Robert Eby\r
  * @version $Id: FeedAuthorization.java,v 1.2 2013/06/20 14:11:05 eby Exp $\r
  */\r
 public class FeedAuthorization implements JSONable {\r
-       private String classification;\r
-       private Set<FeedEndpointID> endpoint_ids;\r
-       private Set<String> endpoint_addrs;\r
-\r
-       public FeedAuthorization() {\r
-               this.classification = "";\r
-               this.endpoint_ids = new HashSet<FeedEndpointID>();\r
-               this.endpoint_addrs = new HashSet<String>();\r
-       }\r
-       public String getClassification() {\r
-               return classification;\r
-       }\r
-       public void setClassification(String classification) {\r
-               this.classification = classification;\r
-       }\r
-       public Set<FeedEndpointID> getEndpoint_ids() {\r
-               return endpoint_ids;\r
-       }\r
-       public void setEndpoint_ids(Set<FeedEndpointID> endpoint_ids) {\r
-               this.endpoint_ids = endpoint_ids;\r
-       }\r
-       public Set<String> getEndpoint_addrs() {\r
-               return endpoint_addrs;\r
-       }\r
-       public void setEndpoint_addrs(Set<String> endpoint_addrs) {\r
-               this.endpoint_addrs = endpoint_addrs;\r
-       }\r
-\r
-       @Override\r
-       public JSONObject asJSONObject() {\r
-               JSONObject jo = new JSONObject();\r
-               jo.put("classification", classification);\r
-               JSONArray ja = new JSONArray();\r
-               for (FeedEndpointID eid : endpoint_ids) {\r
-                       ja.put(eid.asJSONObject());\r
-               }\r
-               jo.put("endpoint_ids", ja);\r
-               ja = new JSONArray();\r
-               for (String t : endpoint_addrs) {\r
-                       ja.put(t);\r
-               }\r
-               jo.put("endpoint_addrs", ja);\r
-               return jo;\r
-       }\r
-       @Override\r
-       public boolean equals(Object obj) {\r
-               if (!(obj instanceof FeedAuthorization))\r
-                       return false;\r
-               FeedAuthorization of = (FeedAuthorization) obj;\r
-               if (!classification.equals(of.classification))\r
-                       return false;\r
-               if (!endpoint_ids.equals(of.endpoint_ids))\r
-                       return false;\r
-               if (!endpoint_addrs.equals(of.endpoint_addrs))\r
-                       return false;\r
-               return true;\r
-       }\r
+\r
+    private String classification;\r
+    private Set<FeedEndpointID> endpointIds;\r
+    private Set<String> endpointAddrs;\r
+\r
+    /**\r
+     * FeedAuthoization constructor.\r
+     */\r
+    public FeedAuthorization() {\r
+        this.classification = "";\r
+        this.endpointIds = new HashSet<>();\r
+        this.endpointAddrs = new HashSet<>();\r
+    }\r
+\r
+    public String getClassification() {\r
+        return classification;\r
+    }\r
+\r
+    public void setClassification(String classification) {\r
+        this.classification = classification;\r
+    }\r
+\r
+    public Set<FeedEndpointID> getEndpointIDS() {\r
+        return endpointIds;\r
+    }\r
+\r
+    public void setEndpointIDS(Set<FeedEndpointID> endpointIds) {\r
+        this.endpointIds = endpointIds;\r
+    }\r
+\r
+    public Set<String> getEndpointAddrs() {\r
+        return endpointAddrs;\r
+    }\r
+\r
+    public void setEndpointAddrs(Set<String> endpointAddrs) {\r
+        this.endpointAddrs = endpointAddrs;\r
+    }\r
+\r
+    @Override\r
+    public JSONObject asJSONObject() {\r
+        JSONObject jo = new JSONObject();\r
+        jo.put("classification", classification);\r
+        JSONArray ja = new JSONArray();\r
+        for (FeedEndpointID eid : endpointIds) {\r
+            ja.put(eid.asJSONObject());\r
+        }\r
+        jo.put("endpoint_ids", ja);\r
+        ja = new JSONArray();\r
+        for (String t : endpointAddrs) {\r
+            ja.put(t);\r
+        }\r
+        jo.put("endpoint_addrs", ja);\r
+        return jo;\r
+    }\r
+\r
+    @Override\r
+    public boolean equals(Object obj) {\r
+        if (!(obj instanceof FeedAuthorization)) {\r
+            return false;\r
+        }\r
+        FeedAuthorization of = (FeedAuthorization) obj;\r
+        if (!classification.equals(of.classification)) {\r
+            return false;\r
+        }\r
+        if (!endpointIds.equals(of.endpointIds)) {\r
+            return false;\r
+        }\r
+        if (!endpointAddrs.equals(of.endpointAddrs)) {\r
+            return false;\r
+        }\r
+        return true;\r
+    }\r
+\r
+    @Override\r
+    public int hashCode() {\r
+        return Objects.hash(classification, endpointIds, endpointAddrs);\r
+    }\r
 }\r