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, sameHost
public DBAddress(String urlFormat) throws UnknownHostException
urlFormat
- the URL-formatted host and portUnknownHostException
MongoClientURI
public DBAddress(DBAddress other, String dbname) throws UnknownHostException
other
- an existing DBAddress
that gives the host and portdbname
- the database to which to connectUnknownHostException
public DBAddress(String host, String dbname) throws UnknownHostException
host
- host namedbname
- database nameUnknownHostException
public DBAddress(String host, int port, String dbname) throws UnknownHostException
host
- host nameport
- database portdbname
- database nameUnknownHostException
public DBAddress(InetAddress addr, int port, String dbname)
addr
- host addressport
- database portdbname
- database namepublic int hashCode()
hashCode
in class ServerAddress
public boolean equals(Object other)
equals
in class ServerAddress
public DBAddress getSister(String name)
name
- database nameMongoException
public String getDBName()
public String toString()
toString
in class ServerAddress