X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=PolicyEngineAPI%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fstd%2FMatches.java;h=b3486e45b8fb9c1c14e3986ff60c7c1bd1d6b54b;hb=5450bdbfb94fb5217617da6c41971fd26f7e81b5;hp=eb382a63da4438cf13e5bbeb4e4d57d4001ae4a2;hpb=a9710cb3b80c73c98d257c676ba6ecf9e30ef758;p=policy%2Fengine.git 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 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 getConfigAttributes() { - return configAttributes; - } - public void setConfigAttributes(Map configAttributes) { - this.configAttributes = configAttributes; - } - + private String onapName = null; + + private String configName = null; + + private Map 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 getConfigAttributes() { + return configAttributes; + } + + public void setConfigAttributes(final Map 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); + } + }