com.mongodb
Class DBAddress

java.lang.Object
  extended by com.mongodb.ServerAddress
      extended by com.mongodb.DBAddress

public class DBAddress
extends ServerAddress

Aquires the address of the database(s).


Constructor Summary
DBAddress(DBAddress other, java.lang.String dbname)
          Connects to a given database using the host/port information from an existing DBAddress.
DBAddress(java.net.InetAddress addr, int port, java.lang.String dbname)
          Connects to a database with a given host, port, and name
DBAddress(java.lang.String urlFormat)
          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"
DBAddress(java.lang.String host, int port, java.lang.String dbname)
          Connects to a database with a given host, port, and name
DBAddress(java.lang.String host, java.lang.String dbname)
          Connects to a database with a given name at a given host.
 
Method Summary
 boolean equals(java.lang.Object other)
           
 java.lang.String getDBName()
           
 DBAddress getSister(java.lang.String name)
           
 int hashCode()
           
 java.lang.String toString()
          String representation of address as host:port/dbname.
 
Methods inherited from class com.mongodb.ServerAddress
defaultHost, defaultPort, getHost, getPort, getSocketAddress, sameHost
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DBAddress

public DBAddress(java.lang.String urlFormat)
          throws java.net.UnknownHostException
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 -
Throws:
java.net.UnknownHostException

DBAddress

public DBAddress(DBAddress other,
                 java.lang.String dbname)
          throws java.net.UnknownHostException
Connects to a given database using the host/port information from an existing DBAddress.

Parameters:
other - the existing DBAddress
name - the database to which to connect
Throws:
java.net.UnknownHostException

DBAddress

public DBAddress(java.lang.String host,
                 java.lang.String dbname)
          throws java.net.UnknownHostException
Connects to a database with a given name at a given host.

Parameters:
host - host name
name - database name
Throws:
java.net.UnknownHostException

DBAddress

public DBAddress(java.lang.String host,
                 int port,
                 java.lang.String dbname)
          throws java.net.UnknownHostException
Connects to a database with a given host, port, and name

Parameters:
host - host name
port - database port
name - database name
Throws:
java.net.UnknownHostException

DBAddress

public DBAddress(java.net.InetAddress addr,
                 int port,
                 java.lang.String dbname)
Connects to a database with a given host, port, and name

Parameters:
addr - host address
port - database port
name - database name
Method Detail

hashCode

public int hashCode()
Overrides:
hashCode in class ServerAddress

equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class ServerAddress

getSister

public DBAddress getSister(java.lang.String name)

getDBName

public java.lang.String getDBName()

toString

public java.lang.String toString()
String representation of address as host:port/dbname.

Overrides:
toString in class ServerAddress
Returns:
this address