Package com.mongodb
Class ServerAddress
java.lang.Object
com.mongodb.ServerAddress
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
UnixServerAddress
Represents the location of a Mongo server - i.e. server name and port number
- See Also:
-
Constructor Summary
ConstructorDescriptionCreates a ServerAddress with default host and portServerAddress
(String host) Creates a ServerAddress with default portServerAddress
(String host, int port) Creates a ServerAddressServerAddress
(InetAddress inetAddress) Creates a ServerAddress with default portServerAddress
(InetAddress inetAddress, int port) Creates a ServerAddressServerAddress
(InetSocketAddress inetSocketAddress) Creates a ServerAddress -
Method Summary
-
Constructor Details
-
ServerAddress
public ServerAddress()Creates a ServerAddress with default host and port -
ServerAddress
Creates a ServerAddress with default port- Parameters:
host
- hostname
-
ServerAddress
Creates a ServerAddress with default port- Parameters:
inetAddress
- host address
-
ServerAddress
Creates a ServerAddress- Parameters:
inetAddress
- host addressport
- mongod port
-
ServerAddress
Creates a ServerAddress- Parameters:
inetSocketAddress
- inet socket address containing hostname and port
-
ServerAddress
Creates a ServerAddress- Parameters:
host
- hostnameport
- mongod port
-
-
Method Details
-
equals
-
hashCode
public int hashCode() -
getHost
Gets the hostname- Returns:
- hostname
-
getPort
public int getPort()Gets the port number- Returns:
- port
-
toString
-
defaultHost
Returns the default database host: "127.0.0.1"- Returns:
- IP address of default host.
-
defaultPort
public static int defaultPort()Returns the default database port: 27017- Returns:
- the default port
-