public final class Host extends Object implements Addressable<IpAddress>, Distributable, Serializable
Instances of this class are immutable, making them inherently threadsafe.
This class overrides equals(java.lang.Object)
and hashCode()
so that instances
play nicely with the Collection classes.
Constructor and Description |
---|
Host(IpAddress ipAddress,
PortNumber port)
Creates a host.
|
Modifier and Type | Method and Description |
---|---|
IpAddress |
address()
Gets the address.
|
boolean |
equals(Object o) |
int |
hashCode() |
PortNumber |
port()
Returns the port on which the host is listening.
|
String |
toString() |
public Host(IpAddress ipAddress, PortNumber port)
ipAddress
- host's IP addressport
- port the host is listening topublic IpAddress address()
Addressable
address
in interface Addressable<IpAddress>
public PortNumber port()
Copyright © 2016. All Rights Reserved.