aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/org/onap/aai/graphgraph/dto/Property.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/onap/aai/graphgraph/dto/Property.java')
-rw-r--r--src/main/java/org/onap/aai/graphgraph/dto/Property.java37
1 files changed, 36 insertions, 1 deletions
diff --git a/src/main/java/org/onap/aai/graphgraph/dto/Property.java b/src/main/java/org/onap/aai/graphgraph/dto/Property.java
index 0e0d1d6..cf0774c 100644
--- a/src/main/java/org/onap/aai/graphgraph/dto/Property.java
+++ b/src/main/java/org/onap/aai/graphgraph/dto/Property.java
@@ -1,6 +1,6 @@
package org.onap.aai.graphgraph.dto;
-public class Property {
+public class Property implements Comparable<Property>{
private String propertyName;
private String propertyValue;
@@ -24,4 +24,39 @@ public class Property {
public void setPropertyValue(String propertyValue) {
this.propertyValue = propertyValue;
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ Property property = (Property) o;
+
+ if (!propertyName.equals(property.propertyName)) {
+ return false;
+ }
+ return propertyValue.equals(property.propertyValue);
+
+ }
+
+ @Override
+ public int hashCode() {
+ int result = propertyName.hashCode();
+ result = 31 * result + propertyValue.hashCode();
+ return result;
+ }
+
+ @Override
+ public int compareTo(Property o) {
+ if (o.getPropertyName().equals(getPropertyName()) && o.getPropertyValue() != null
+ && getPropertyValue() != null) {
+ return getPropertyValue().compareTo(o.getPropertyValue());
+ }
+
+ return propertyName.compareTo(o.getPropertyName());
+ }
}