Add hashCode and equals.
This commit is contained in:
parent
c3428ea4a5
commit
84ac4bb28c
1 changed files with 24 additions and 0 deletions
|
|
@ -25,6 +25,7 @@ import java.util.EnumSet;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
|
@ -350,4 +351,27 @@ public class VmDefinition {
|
|||
return this.<Number> fromStatus("displayPasswordSerial")
|
||||
.map(Number::longValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(metadata.getNamespace(), metadata.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
VmDefinition other = (VmDefinition) obj;
|
||||
return Objects.equals(metadata.getNamespace(),
|
||||
other.metadata.getNamespace())
|
||||
&& Objects.equals(metadata.getName(), other.metadata.getName());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue