Package com.mongodb
Class DBAddress
- java.lang.Object
-
- com.mongodb.ServerAddress
-
- com.mongodb.DBAddress
-
- All Implemented Interfaces:
Serializable
Deprecated.This class is no longer needed, as the driver does not rely on it for anything anymore. UseServerAddress
instead.
@Deprecated public class DBAddress extends ServerAddress
Represents a database address, which includes the properties of ServerAddress (host and port) and adds a database name.- See Also:
- Serialized Form
- MongoDB documentation
- MongoDB Ports
- MongoDB Connection String
-
-
Constructor Summary
Constructors Constructor Description DBAddress(DBAddress other, String databaseName)
Deprecated.Create a DBAddress using the host and port from an existing DBAddress, and connected to a given database.DBAddress(String urlFormat)
Deprecated.Creates a new address.DBAddress(String host, int port, String databaseName)
Deprecated.Creates a DBAddress for the given database on the given host at the given port.DBAddress(String host, String databaseName)
Deprecated.Creates a DBAddress for the given database on the given host.DBAddress(InetAddress inetAddress, int port, String databaseName)
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
equals(Object other)
Deprecated.String
getDBName()
Deprecated.Gets the database nameDBAddress
getSister(String name)
Deprecated.Creates a DBAddress pointing to a different database on the same server.int
hashCode()
Deprecated.String
toString()
Deprecated.Gets a String representation of address as host:port/databaseName.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from class com.mongodb.ServerAddress
defaultHost, defaultPort, getHost, getPort, getSocketAddress, getSocketAddresses, sameHost
-
-
-
-
Constructor Detail
-
DBAddress
public DBAddress(String urlFormat)
Deprecated.Creates a new address. Accepts as the parameter format:- name "mydb"
- <host>/name "127.0.0.1/mydb"
- <host>:<port>/name "127.0.0.1:8080/mydb"
- Parameters:
urlFormat
- the URL-formatted host and port- See Also:
MongoClientURI
- MongoDB documentation
- MongoDB Connection String
-
DBAddress
public DBAddress(DBAddress other, String databaseName)
Deprecated.Create a DBAddress using the host and port from an existing DBAddress, and connected to a given database.- Parameters:
other
- an existingDBAddress
that gives the host and portdatabaseName
- the database to which to connect
-
DBAddress
public DBAddress(String host, String databaseName)
Deprecated.Creates a DBAddress for the given database on the given host.- Parameters:
host
- host namedatabaseName
- database name
-
DBAddress
public DBAddress(String host, int port, String databaseName)
Deprecated.Creates a DBAddress for the given database on the given host at the given port.- Parameters:
host
- host nameport
- database portdatabaseName
- database name
-
DBAddress
public DBAddress(InetAddress inetAddress, int port, String databaseName)
Deprecated.- Parameters:
inetAddress
- host addressport
- database portdatabaseName
- database name
-
-
Method Detail
-
hashCode
public int hashCode()
Deprecated.- Overrides:
hashCode
in classServerAddress
-
equals
public boolean equals(Object other)
Deprecated.- Overrides:
equals
in classServerAddress
-
getSister
public DBAddress getSister(String name)
Deprecated.Creates a DBAddress pointing to a different database on the same server.- Parameters:
name
- database name- Returns:
- the DBAddress for the given name with the same host and port as this
- Throws:
MongoException
- if failed
-
getDBName
public String getDBName()
Deprecated.Gets the database name- Returns:
- the database name
-
toString
public String toString()
Deprecated.Gets a String representation of address as host:port/databaseName.- Overrides:
toString
in classServerAddress
- Returns:
- this address
-
-