@Immutable public class ServerAddress extends java.lang.Object implements java.io.Serializable
Constructor and Description |
---|
ServerAddress()
Creates a ServerAddress with default host and port
|
ServerAddress(java.net.InetAddress inetAddress)
Creates a ServerAddress with default port
|
ServerAddress(java.net.InetAddress inetAddress,
int port)
Creates a ServerAddress
|
ServerAddress(java.net.InetSocketAddress inetSocketAddress)
Creates a ServerAddress
|
ServerAddress(java.lang.String host)
Creates a ServerAddress with default port
|
ServerAddress(java.lang.String host,
int port)
Creates a ServerAddress
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
defaultHost()
Returns the default database host: "127.0.0.1"
|
static int |
defaultPort()
Returns the default database port: 27017
|
boolean |
equals(java.lang.Object o) |
java.lang.String |
getHost()
Gets the hostname
|
int |
getPort()
Gets the port number
|
java.net.InetSocketAddress |
getSocketAddress()
Gets the underlying socket address
|
int |
hashCode() |
boolean |
sameHost(java.lang.String hostName)
Deprecated.
use the
equals(Object) method instead |
java.lang.String |
toString() |
public ServerAddress()
public ServerAddress(@Nullable java.lang.String host)
host
- hostnamepublic ServerAddress(java.net.InetAddress inetAddress)
inetAddress
- host addresspublic ServerAddress(java.net.InetAddress inetAddress, int port)
inetAddress
- host addressport
- mongod portpublic ServerAddress(java.net.InetSocketAddress inetSocketAddress)
inetSocketAddress
- inet socket address containing hostname and portpublic ServerAddress(@Nullable java.lang.String host, int port)
host
- hostnameport
- mongod portpublic boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String getHost()
public int getPort()
public java.net.InetSocketAddress getSocketAddress()
public java.lang.String toString()
toString
in class java.lang.Object
public static java.lang.String defaultHost()
public static int defaultPort()
@Deprecated public boolean sameHost(java.lang.String hostName)
equals(Object)
method insteadhostName
- the address to compareCopyright © 2010 - 2020 Adobe. All Rights Reserved