X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=appc-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fopenecomp%2Fappc%2Fmetadata%2Fobjects%2FDependencyModelIdentifier.java;h=8b1b5870aeb33f6b1fba2aa447ebe4a90148dcc2;hb=cf896d8cff45754a3bdb00f2f277eef3a5ae0cd2;hp=f768233081aaa601012486103084bade6f550988;hpb=3f8e7fc7d4bdc18d14504e5189ac242f28ea328a;p=appc.git diff --git a/appc-common/src/main/java/org/openecomp/appc/metadata/objects/DependencyModelIdentifier.java b/appc-common/src/main/java/org/openecomp/appc/metadata/objects/DependencyModelIdentifier.java index f76823308..8b1b5870a 100644 --- a/appc-common/src/main/java/org/openecomp/appc/metadata/objects/DependencyModelIdentifier.java +++ b/appc-common/src/main/java/org/openecomp/appc/metadata/objects/DependencyModelIdentifier.java @@ -24,51 +24,67 @@ package org.openecomp.appc.metadata.objects; - +/** + * Object of identifier for dependency model. + * Currently uses VNF type and catalog version + */ public class DependencyModelIdentifier { + static final String TO_STRING_FORMAT = "DependencyModelIdentifier : vnfType = %s , catalogVersion = %s"; + static final int prime = 31; + private String vnfType; private String catalogVersion; - public DependencyModelIdentifier(String vnfType, String catalogVersion){ + /** + * Constructor + * @param vnfType String of the VNF type + * @param catalogVersion String of the catalog version + */ + public DependencyModelIdentifier(String vnfType, String catalogVersion) { this.vnfType = vnfType; this.catalogVersion = catalogVersion; } - public int hashCode(){ - final int prime = 31; + @Override + public int hashCode() { int result = 1; result = result * prime + (this.vnfType == null ? 0 :this.vnfType.hashCode()); result = result * prime + (this.catalogVersion == null ? 0 :this.catalogVersion.hashCode()); return result; } - public boolean equals(Object obj){ - if(obj ==null) + @Override + public boolean equals(Object obj) { + if (obj ==null) { return false; - if(!(obj instanceof DependencyModelIdentifier)) + } + if (!(obj instanceof DependencyModelIdentifier)) { return false; + } DependencyModelIdentifier modelIdentifier = (DependencyModelIdentifier)obj; - if(this.vnfType == null){ - if(modelIdentifier.vnfType !=null) + if (this.vnfType == null) { + if (modelIdentifier.vnfType !=null) { return false; - } - else if(!this.vnfType.equals(modelIdentifier.vnfType)) + } + } else if (!this.vnfType.equals(modelIdentifier.vnfType)) { return false; + } - if(this.catalogVersion == null){ - if(modelIdentifier.catalogVersion !=null) + if (this.catalogVersion == null) { + if (modelIdentifier.catalogVersion !=null) { return false; - } - else if(!this.catalogVersion.equals(modelIdentifier.catalogVersion)) + } + } else if (!this.catalogVersion.equals(modelIdentifier.catalogVersion)) { return false; + } return true; } @Override public String toString() { - return "DependencyModelIdentifier : vnfType = "+vnfType + " , catalogVersion = " +catalogVersion; + return String.format(TO_STRING_FORMAT, vnfType, catalogVersion); } public String getVnfType() {