public class DBAddress extends ServerAddress
| Constructor and Description |
|---|
DBAddress(DBAddress other,
String dbname)
Create a DBAddress using the host and port from an existing DBAddress, and connected to a given database.
|
DBAddress(InetAddress addr,
int port,
String dbname) |
DBAddress(String urlFormat)
Creates a new address.
|
DBAddress(String host,
int port,
String dbname)
Creates a DBAddress for the given database on the given host at the given port.
|
DBAddress(String host,
String dbname)
Creates a DBAddress for the given database on the given host.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object other) |
String |
getDBName()
Gets the database name
|
DBAddress |
getSister(String name)
Creates a DBAddress pointing to a different database on the same server.
|
int |
hashCode() |
String |
toString()
Gets a String representation of address as host:port/databaseName.
|
defaultHost, defaultPort, getHost, getPort, getSocketAddress, sameHostpublic DBAddress(String urlFormat) throws UnknownHostException
urlFormat - the URL-formatted host and portUnknownHostExceptionMongoClientURIpublic DBAddress(DBAddress other, String dbname) throws UnknownHostException
other - an existing DBAddress that gives the host and portdbname - the database to which to connectUnknownHostExceptionpublic DBAddress(String host, String dbname) throws UnknownHostException
host - host namedbname - database nameUnknownHostExceptionpublic DBAddress(String host, int port, String dbname) throws UnknownHostException
host - host nameport - database portdbname - database nameUnknownHostExceptionpublic DBAddress(InetAddress addr, int port, String dbname)
addr - host addressport - database portdbname - database namepublic int hashCode()
hashCode in class ServerAddresspublic boolean equals(Object other)
equals in class ServerAddresspublic DBAddress getSister(String name)
name - database nameMongoExceptionpublic String getDBName()
public String toString()
toString in class ServerAddress