aboutsummaryrefslogtreecommitdiffstats
path: root/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaConceptIdentifierOptVersion.java
diff options
context:
space:
mode:
Diffstat (limited to 'models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaConceptIdentifierOptVersion.java')
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaConceptIdentifierOptVersion.java48
1 files changed, 12 insertions, 36 deletions
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaConceptIdentifierOptVersion.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaConceptIdentifierOptVersion.java
index c23c04fe8..62c1ed7ef 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaConceptIdentifierOptVersion.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaConceptIdentifierOptVersion.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP Policy Models
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2020-2021 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -21,58 +21,34 @@
package org.onap.policy.models.tosca.authorative.concepts;
-import lombok.Data;
+import java.io.Serializable;
+import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.NonNull;
-import org.apache.commons.lang3.ObjectUtils;
/**
- * Concept identifier with an optional version; only the "name" is required.
+ * Concept identifier with an optional name and version.
*/
-@Data
+@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
-public class ToscaConceptIdentifierOptVersion implements Comparable<ToscaConceptIdentifierOptVersion> {
-
- @NonNull
- private String name;
-
- private String version;
+public class ToscaConceptIdentifierOptVersion extends ToscaNameVersion
+ implements Serializable, Comparable<ToscaConceptIdentifierOptVersion> {
+ private static final long serialVersionUID = 8010649773816325786L;
public ToscaConceptIdentifierOptVersion(@NonNull String name, String version) {
- this.name = name;
- this.version = version;
+ super(name, version);
}
public ToscaConceptIdentifierOptVersion(ToscaConceptIdentifierOptVersion source) {
- this.name = source.name;
- this.version = source.version;
+ super(source);
}
public ToscaConceptIdentifierOptVersion(ToscaConceptIdentifier source) {
- this.name = source.getName();
- this.version = source.getVersion();
+ super(source.getName(), source.getVersion());
}
@Override
public int compareTo(ToscaConceptIdentifierOptVersion other) {
- if (this == other) {
- return 0;
- }
-
- if (other == null) {
- return 1;
- }
-
- int result = ObjectUtils.compare(getName(), other.getName());
- if (result != 0) {
- return result;
- }
-
- return ObjectUtils.compare(getVersion(), other.getVersion());
- }
-
- @Override
- public String toString() {
- return this.name + " " + this.version;
+ return commonCompareTo(other);
}
}