com.yahoo.vespa.hosted.provision.node.Address Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of node-repository Show documentation
Show all versions of node-repository Show documentation
Keeps track of node assignment in a multi-application setup.
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.provision.node;
import java.util.Objects;
/**
* Address info about a container that might run on a host.
*
* @author hakon
*/
public class Address {
private final String hostname;
public Address(String hostname) {
this.hostname = validateHostname(hostname, "hostname");
}
public String hostname() {
return hostname;
}
@Override
public String toString() {
return "Address{" +
"hostname='" + hostname + '\'' +
'}';
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Address address = (Address) o;
return hostname.equals(address.hostname);
}
@Override
public int hashCode() {
return Objects.hash(hostname);
}
private String validateHostname(String value, String name) {
Objects.requireNonNull(value, name + " cannot be null");
if (value.isEmpty()) {
throw new IllegalArgumentException(name + " cannot be empty");
}
return value;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy