aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeil Derraugh <neil.derraugh@yoppworks.com>2020-04-23 17:03:33 -0400
committerOfir Sonsino <ofir.sonsino@intl.att.com>2020-05-05 08:16:36 +0000
commit45d6bf5520f9c70e57e473b109870b8ad0eb7251 (patch)
tree5ea2a47fa45baeb114aa05c08e35e5f308667c17
parent722eed1c46361a2d8136f1fac528a96749f5dbbd (diff)
Replace hashCode and equals methods to cleanup NPE warning
Replace hashCode() and equals() with Lombok @EqualsAndHashCode(callSuper = true) Issue-ID: SDC-2925 Signed-off-by: neil.derraugh <neil.derraugh@yoppworks.com> Change-Id: I51056103dc7df953508b2e465a535b46c63e2667
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ResourceMetadataDataDefinition.java106
1 files changed, 13 insertions, 93 deletions
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ResourceMetadataDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ResourceMetadataDataDefinition.java
index 8b78450358..ddb25c6e29 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ResourceMetadataDataDefinition.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ResourceMetadataDataDefinition.java
@@ -20,10 +20,11 @@
package org.openecomp.sdc.be.datatypes.components;
+import lombok.EqualsAndHashCode;
import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFieldsExtractor;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
-
+@EqualsAndHashCode(callSuper = true)
public class ResourceMetadataDataDefinition extends ComponentMetadataDataDefinition {
private String vendorName;
@@ -50,16 +51,16 @@ public class ResourceMetadataDataDefinition extends ComponentMetadataDataDefinit
this.isAbstract = other.isHighestVersion();
this.resourceType = other.getResourceType();
this.toscaResourceName = other.getToscaResourceName();
- }
+ }
- public ResourceMetadataDataDefinition(JsonPresentationFieldsExtractor extractor){
- super(extractor);
- this.vendorName = extractor.getVendorName();
- this.vendorRelease = extractor.getVendorRelease();
- this.resourceVendorModelNumber = extractor.getResourceVendorModelNumber();
- this.isAbstract = extractor.isAbstract();
- this.resourceType = extractor.getResourceType();
- this.toscaResourceName = extractor.getToscaResourceName();
+ public ResourceMetadataDataDefinition(JsonPresentationFieldsExtractor extractor) {
+ super(extractor);
+ this.vendorName = extractor.getVendorName();
+ this.vendorRelease = extractor.getVendorRelease();
+ this.resourceVendorModelNumber = extractor.getResourceVendorModelNumber();
+ this.isAbstract = extractor.isAbstract();
+ this.resourceType = extractor.getResourceType();
+ this.toscaResourceName = extractor.getToscaResourceName();
}
public String getVendorName() {
@@ -86,7 +87,6 @@ public class ResourceMetadataDataDefinition extends ComponentMetadataDataDefinit
this.resourceVendorModelNumber = resourceVendorModelNumber;
}
-
public ResourceTypeEnum getResourceType() {
return resourceType;
}
@@ -130,88 +130,8 @@ public class ResourceMetadataDataDefinition extends ComponentMetadataDataDefinit
@Override
public String toString() {
return "ResourceMetadataDataDefinition [vendorName=" + vendorName + ", vendorRelease=" + vendorRelease
- + ", resourceVendorModelNumber=" + resourceVendorModelNumber + ", resourceType=" + resourceType
- + ", isAbstract=" + isAbstract + super.toString() + "]";
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- result = prime * result + ((cost == null) ? 0 : cost.hashCode());
- result = prime * result + ((isAbstract == null) ? 0 : isAbstract.hashCode());
- result = prime * result + ((licenseType == null) ? 0 : licenseType.hashCode());
- result = prime * result + ((resourceType == null) ? 0 : resourceType.hashCode());
- result = prime * result + ((vendorName == null) ? 0 : vendorName.hashCode());
- result = prime * result + ((vendorRelease == null) ? 0 : vendorRelease.hashCode());
- result = prime * result + ((resourceVendorModelNumber == null) ? 0 : resourceVendorModelNumber.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (!super.equals(obj)) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- ResourceMetadataDataDefinition other = (ResourceMetadataDataDefinition) obj;
- if (cost == null) {
- if (other.cost != null) {
- return false;
- }
- } else if (!cost.equals(other.cost)) {
- return false;
- }
- if (isAbstract == null) {
- if (other.isAbstract != null) {
- return false;
- }
- } else if (!isAbstract.equals(other.isAbstract)) {
- return false;
- }
- if (licenseType == null) {
- if (other.licenseType != null) {
- return false;
- }
- } else if (!licenseType.equals(other.licenseType)) {
- return false;
- }
- if (resourceType != other.resourceType) {
- return false;
- }
- if (vendorName == null) {
- if (other.vendorName != null) {
- return false;
- }
- } else if (!vendorName.equals(other.vendorName)) {
- return false;
- }
- if (vendorRelease == null) {
- if (other.vendorRelease != null) {
- return false;
- }
- }
- if (toscaResourceName == null) {
- if (other.toscaResourceName != null) {
- return false;
- }
- } else if (!vendorRelease.equals(other.vendorRelease)) {
- return false;
- }
- if (resourceVendorModelNumber == null) {
- if (other.resourceVendorModelNumber != null) {
- return false;
- }
- } else if (!resourceVendorModelNumber.equals(other.resourceVendorModelNumber)) {
- return false;
- }
-
- return super.equals(obj);
+ + ", resourceVendorModelNumber=" + resourceVendorModelNumber + ", resourceType=" + resourceType
+ + ", isAbstract=" + isAbstract + super.toString() + "]";
}
@Override