public class ConnectionEndpoint extends Object implements Cloneable, Comparable<ConnectionEndpoint>
Cloneable,
Comparable| Modifier and Type | Field and Description |
|---|---|
protected static String |
DEFAULT_HOST |
protected static int |
DEFAULT_PORT |
protected static String |
GEMFIRE_HOST_PORT_SEPARATOR |
protected static String |
STANDARD_HOST_PORT_SEPARATOR |
| Constructor and Description |
|---|
ConnectionEndpoint(String host,
int port)
Constructs a ConnectionEndpoint initialized with the specific host and port.
|
| Modifier and Type | Method and Description |
|---|---|
protected Object |
clone() |
int |
compareTo(ConnectionEndpoint connectionEndpoint) |
boolean |
equals(Object obj) |
static ConnectionEndpoint |
from(InetSocketAddress socketAddress)
Factory method used to convert the given
InetSocketAddress into a ConnectionEndpoint. |
static ConnectionEndpoint |
from(int port)
Factory method used to construct a new
ConnectionEndpoint with the given port
listening on the default host. |
static ConnectionEndpoint |
from(String host,
int port)
|
String |
getHost()
Gets the host in this ConnectionEndpoint.
|
int |
getPort()
Gets the port number in this ConnectionEndpoint.
|
int |
hashCode() |
static ConnectionEndpoint |
parse(String hostPort)
Parses the host and port String value into a valid ConnectionEndpoint.
|
static ConnectionEndpoint |
parse(String hostPort,
int defaultPort)
Factory method used to parse the
host and port value into a valid ConnectionEndpoint. |
InetSocketAddress |
toInetSocketAddress()
Converts this
ConnectionEndpoint into an InetSocketAddress representation. |
String |
toString() |
protected static final int DEFAULT_PORT
protected static final String DEFAULT_HOST
protected static final String GEMFIRE_HOST_PORT_SEPARATOR
protected static final String STANDARD_HOST_PORT_SEPARATOR
public ConnectionEndpoint(String host, int port)
host - the hostname or IP address of the ConnectionEndpoint. If the host is unspecified,
then ConnectionEndpoint.DEFAULT_HOST will be used.port - the (service) port number in this ConnectionEndpoint.IllegalArgumentException - if the port number is less than 0.DEFAULT_HOST@NonNull public static ConnectionEndpoint from(int port)
ConnectionEndpoint with the given port
listening on the default host.port - port of the ConnectionEndpoint.ConnectionEndpoint with the given port listening on the default host.from(String, int)@NonNull public static ConnectionEndpoint from(String host, int port)
host - host of the ConnectionEndpoint.port - port of the ConnectionEndpoint.ConnectionEndpoint with the given host and port.@NonNull public static ConnectionEndpoint from(@NonNull InetSocketAddress socketAddress)
InetSocketAddress into a ConnectionEndpoint.socketAddress - InetSocketAddress used to construct, configure and initialize
the ConnectionEndpoint.ConnectionEndpoint representing the InetSocketAddress.InetSocketAddresspublic static ConnectionEndpoint parse(String hostPort)
hostPort - a String value containing the host and port formatted as 'host[port]'.parse(String, int),
DEFAULT_PORTpublic static ConnectionEndpoint parse(String hostPort, int defaultPort)
host and port value into a valid ConnectionEndpoint.hostPort - String containing the host and port formatted as host[port]
or host:port.defaultPort - Integer indicating the default port to use if the port is unspecified
in the host and port value.ConnectionEndpoint initialized with the host and port,
or with the default port if port was unspecified.ConnectionEndpoint(String, int)public String getHost()
public int getPort()
public InetSocketAddress toInetSocketAddress()
ConnectionEndpoint into an InetSocketAddress representation.InetSocketAddress representation of this ConnectionEndpoint.InetSocketAddress,
getHost(),
getPort()protected Object clone() throws CloneNotSupportedException
clone in class ObjectCloneNotSupportedExceptionpublic int compareTo(ConnectionEndpoint connectionEndpoint)
compareTo in interface Comparable<ConnectionEndpoint>Copyright © 2011–2021 Pivotal Software, Inc.. All rights reserved.