public class HostWithPort extends Object
Modifier and Type | Field and Description |
---|---|
static int |
PORT_MAX
Maximum acceptable port value: 65535.
|
static int |
PORT_MIN
Minimum acceptable port value: 0.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object other) |
@NonNull String |
getHost()
Gets the host.
|
int |
getPort()
Gets the port.
|
int |
hashCode() |
static @NonNull HostWithPort |
of(@NonNull String host,
@IntRange(from=0L,to=65535L) int port)
Constructs a HostWithPort with the given host and port.
|
String |
toString() |
@NonNull HostWithPort |
withHost(@NonNull String host)
Returns a new instance with the given host and this object's port.
|
@NonNull HostWithPort |
withPort(@IntRange(from=0L,to=65535L) int port)
Returns a new instance with the given port and this object's host.
|
public static final int PORT_MIN
public static final int PORT_MAX
public static @NonNull HostWithPort of(@NonNull String host, @IntRange(from=0L,to=65535L) int port)
host
- hostport
- portpublic @NonNull String getHost()
public int getPort()
public @NonNull HostWithPort withHost(@NonNull String host)
host
- new hostpublic @NonNull HostWithPort withPort(@IntRange(from=0L,to=65535L) int port)
port
- new portCopyright © 2013–2021 Kitteh. All rights reserved.