Package com.mongodb
Class ServerAddress
- java.lang.Object
-
- com.mongodb.ServerAddress
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
DBAddress
,UnixServerAddress
@Immutable @Deprecated(since="2021-05-27") public class ServerAddress extends java.lang.Object implements java.io.Serializable
Deprecated.Usage of this API is not supported in AEM as a Cloud Service.Represents the location of a Mongo server - i.e. server name and port number- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ServerAddress()
Deprecated.Creates a ServerAddress with default host and portServerAddress(java.lang.String host)
Deprecated.Creates a ServerAddress with default portServerAddress(java.lang.String host, int port)
Deprecated.Creates a ServerAddressServerAddress(java.net.InetAddress inetAddress)
Deprecated.Creates a ServerAddress with default portServerAddress(java.net.InetAddress inetAddress, int port)
Deprecated.Creates a ServerAddressServerAddress(java.net.InetSocketAddress inetSocketAddress)
Deprecated.Creates a ServerAddress
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static java.lang.String
defaultHost()
Deprecated.Returns the default database host: "127.0.0.1"static int
defaultPort()
Deprecated.Returns the default database port: 27017boolean
equals(java.lang.Object o)
Deprecated.java.lang.String
getHost()
Deprecated.Gets the hostnameint
getPort()
Deprecated.Gets the port numberjava.net.InetSocketAddress
getSocketAddress()
Deprecated.Gets the underlying socket addressjava.util.List<java.net.InetSocketAddress>
getSocketAddresses()
Deprecated.Gets all underlying socket addressesint
hashCode()
Deprecated.boolean
sameHost(java.lang.String hostName)
Deprecated.use theequals(Object)
method insteadjava.lang.String
toString()
Deprecated.
-
-
-
Constructor Detail
-
ServerAddress
public ServerAddress()
Deprecated.Creates a ServerAddress with default host and port
-
ServerAddress
public ServerAddress(@Nullable java.lang.String host)
Deprecated.Creates a ServerAddress with default port- Parameters:
host
- hostname
-
ServerAddress
public ServerAddress(java.net.InetAddress inetAddress)
Deprecated.Creates a ServerAddress with default port- Parameters:
inetAddress
- host address
-
ServerAddress
public ServerAddress(java.net.InetAddress inetAddress, int port)
Deprecated.Creates a ServerAddress- Parameters:
inetAddress
- host addressport
- mongod port
-
ServerAddress
public ServerAddress(java.net.InetSocketAddress inetSocketAddress)
Deprecated.Creates a ServerAddress- Parameters:
inetSocketAddress
- inet socket address containing hostname and port
-
ServerAddress
public ServerAddress(@Nullable java.lang.String host, int port)
Deprecated.Creates a ServerAddress- Parameters:
host
- hostnameport
- mongod port
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object o)
Deprecated.- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
Deprecated.- Overrides:
hashCode
in classjava.lang.Object
-
getHost
public java.lang.String getHost()
Deprecated.Gets the hostname- Returns:
- hostname
-
getPort
public int getPort()
Deprecated.Gets the port number- Returns:
- port
-
getSocketAddress
public java.net.InetSocketAddress getSocketAddress()
Deprecated.Gets the underlying socket address- Returns:
- socket address
-
getSocketAddresses
public java.util.List<java.net.InetSocketAddress> getSocketAddresses()
Deprecated.Gets all underlying socket addresses- Returns:
- array of socket addresses
- Since:
- 3.9
-
toString
public java.lang.String toString()
Deprecated.- Overrides:
toString
in classjava.lang.Object
-
defaultHost
public static java.lang.String defaultHost()
Deprecated.Returns the default database host: "127.0.0.1"- Returns:
- IP address of default host.
-
defaultPort
public static int defaultPort()
Deprecated.Returns the default database port: 27017- Returns:
- the default port
-
sameHost
@Deprecated public boolean sameHost(java.lang.String hostName)
Deprecated.use theequals(Object)
method insteadDetermines whether this address is the same as a given host.- Parameters:
hostName
- the address to compare- Returns:
- if they are the same
-
-