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() {