diff options
Diffstat (limited to 'config-provisioning')
-rw-r--r-- | config-provisioning/src/main/java/com/yahoo/config/provision/HostFilter.java | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/config-provisioning/src/main/java/com/yahoo/config/provision/HostFilter.java b/config-provisioning/src/main/java/com/yahoo/config/provision/HostFilter.java index 95eec2ac0fb..ab84be4b66b 100644 --- a/config-provisioning/src/main/java/com/yahoo/config/provision/HostFilter.java +++ b/config-provisioning/src/main/java/com/yahoo/config/provision/HostFilter.java @@ -27,15 +27,11 @@ public class HostFilter { Set<String> flavors, Set<ClusterSpec.Type> clusterTypes, Set<ClusterSpec.Id> clusterIds) { - Objects.requireNonNull(hostnames, "Hostnames cannot be null, use an empty list"); - Objects.requireNonNull(flavors, "Flavors cannot be null, use an empty list"); - Objects.requireNonNull(clusterTypes, "clusterTypes cannot be null, use an empty list"); - Objects.requireNonNull(clusterIds, "clusterIds cannot be null, use an empty list"); - - this.hostnames = hostnames; - this.flavors = flavors; - this.clusterTypes = clusterTypes; - this.clusterIds = clusterIds; + this.hostnames = Objects.requireNonNull(hostnames, "Hostnames cannot be null, use an empty list"); + this.flavors = Objects.requireNonNull(flavors, "Flavors cannot be null, use an empty list"); + this.clusterTypes = Objects.requireNonNull(clusterTypes, "clusterTypes cannot be null, use an empty list"); + this.clusterIds = Objects.requireNonNull(clusterIds, "clusterIds cannot be null, use an empty list"); + System.out.println(hostnames); } /** Returns true if this filter matches the given host properties */ @@ -92,4 +88,25 @@ public class HostFilter { StringUtilities.split(clusterIds).stream().map(ClusterSpec.Id::from).collect(Collectors.toSet())); } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + HostFilter that = (HostFilter) o; + + if (!hostnames.equals(that.hostnames)) return false; + if (!flavors.equals(that.flavors)) return false; + if (!clusterTypes.equals(that.clusterTypes)) return false; + return clusterIds.equals(that.clusterIds); + } + + @Override + public int hashCode() { + int result = hostnames.hashCode(); + result = 31 * result + flavors.hashCode(); + result = 31 * result + clusterTypes.hashCode(); + result = 31 * result + clusterIds.hashCode(); + return result; + } } |