public class HostAndPort extends Object
| Constructor and Description |
|---|
HostAndPort(String host,
int port)
Constructs an immutable instance given a host and a port.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o) |
static HostAndPort |
fromString(String hostAndPortStr)
Parses a host and port from a string and instantiates an instance of HostAndPort using the obtained values.
|
String |
getHost()
Retrieves the host.
|
int |
getPort()
Retrieves the port.
|
int |
hashCode() |
static HostAndPort |
of(String host,
int port)
Constructs a HostAndPort instance from a host and a port.
|
String |
toString() |
public HostAndPort(String host, int port)
host - hostname or IP address.port - port number.IllegalArgumentException - if host is blank.IllegalArgumentException - if port is outside of the valid range of [0, 65535].public static HostAndPort fromString(String hostAndPortStr)
hostAndPortStr - a string to parse.NullPointerException - if the passed in string is null.IllegalArgumentException - if the passed in string is empty.public static HostAndPort of(String host, int port)
HostAndPort(String, int).host - hostname or IP address.port - port number.public String getHost()
public int getPort()
Copyright © 2016. All rights reserved.