aboutsummaryrefslogtreecommitdiffstats
path: root/PolicyEngineAPI/src/main/java/org/onap/policy/std/Matches.java
diff options
context:
space:
mode:
Diffstat (limited to 'PolicyEngineAPI/src/main/java/org/onap/policy/std/Matches.java')
-rw-r--r--PolicyEngineAPI/src/main/java/org/onap/policy/std/Matches.java79
1 files changed, 57 insertions, 22 deletions
diff --git a/PolicyEngineAPI/src/main/java/org/onap/policy/std/Matches.java b/PolicyEngineAPI/src/main/java/org/onap/policy/std/Matches.java
index eb382a63d..b3486e45b 100644
--- a/PolicyEngineAPI/src/main/java/org/onap/policy/std/Matches.java
+++ b/PolicyEngineAPI/src/main/java/org/onap/policy/std/Matches.java
@@ -23,26 +23,61 @@ package org.onap.policy.std;
import java.util.Map;
public class Matches {
- private String onapName = null;
- private String configName = null;
- private Map<String,String> configAttributes = null;
- public String getOnapName() {
- return onapName;
- }
- public void setOnapName(String onapName) {
- this.onapName = onapName;
- }
- public String getConfigName() {
- return configName;
- }
- public void setConfigName(String configName) {
- this.configName = configName;
- }
- public Map<String,String> getConfigAttributes() {
- return configAttributes;
- }
- public void setConfigAttributes(Map<String,String> configAttributes) {
- this.configAttributes = configAttributes;
- }
-
+ private String onapName = null;
+
+ private String configName = null;
+
+ private Map<String, String> configAttributes = null;
+
+ public String getOnapName() {
+ return onapName;
+ }
+
+ public void setOnapName(final String onapName) {
+ this.onapName = onapName;
+ }
+
+ public String getConfigName() {
+ return configName;
+ }
+
+ public void setConfigName(final String configName) {
+ this.configName = configName;
+ }
+
+ public Map<String, String> getConfigAttributes() {
+ return configAttributes;
+ }
+
+ public void setConfigAttributes(final Map<String, String> configAttributes) {
+ this.configAttributes = configAttributes;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((configAttributes == null) ? 0 : configAttributes.hashCode());
+ result = prime * result + ((configName == null) ? 0 : configName.hashCode());
+ result = prime * result + ((onapName == null) ? 0 : onapName.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (obj instanceof Matches) {
+ final Matches other = (Matches) obj;
+ return isEqual(onapName, other.onapName) && isEqual(configName, other.configName)
+ && isEqual(configAttributes, other.configAttributes);
+ }
+ return false;
+ }
+
+ private boolean isEqual(final Object objectA, final Object objectB) {
+ if (objectA == null) {
+ return objectB == null;
+ }
+ return objectA.equals(objectB);
+ }
+
}