com.mongodb
Class ServerAddress

java.lang.Object
  extended by com.mongodb.ServerAddress
Direct Known Subclasses:
DBAddress

public class ServerAddress
extends java.lang.Object

mongo server address


Constructor Summary
ServerAddress()
           
ServerAddress(java.net.InetAddress addr)
           
ServerAddress(java.net.InetAddress addr, int port)
           
ServerAddress(java.net.InetSocketAddress addr)
           
ServerAddress(java.lang.String host)
           
ServerAddress(java.lang.String host, int port)
           
 
Method Summary
static java.lang.String defaultHost()
          Returns the default database host.
static int defaultPort()
          Returns the default port that the database runs on.
 boolean equals(java.lang.Object other)
           
 java.lang.String getHost()
           
 int getPort()
           
 java.net.InetSocketAddress getSocketAddress()
           
 int hashCode()
           
 boolean sameHost(java.lang.String host)
          Determines whether this address is the same as a given host.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ServerAddress

public ServerAddress()
              throws java.net.UnknownHostException
Throws:
java.net.UnknownHostException

ServerAddress

public ServerAddress(java.lang.String host)
              throws java.net.UnknownHostException
Throws:
java.net.UnknownHostException

ServerAddress

public ServerAddress(java.lang.String host,
                     int port)
              throws java.net.UnknownHostException
Throws:
java.net.UnknownHostException

ServerAddress

public ServerAddress(java.net.InetAddress addr)

ServerAddress

public ServerAddress(java.net.InetAddress addr,
                     int port)

ServerAddress

public ServerAddress(java.net.InetSocketAddress addr)
Method Detail

sameHost

public boolean sameHost(java.lang.String host)
Determines whether this address is the same as a given host.

Parameters:
host - the address to compare
Returns:
if they are the same

equals

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

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

getHost

public java.lang.String getHost()

getPort

public int getPort()

getSocketAddress

public java.net.InetSocketAddress getSocketAddress()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

defaultHost

public static java.lang.String defaultHost()
Returns the default database host.

Returns:
the db_ip environmental variable, or "127.0.0.1" as a default

defaultPort

public static int defaultPort()
Returns the default port that the database runs on.

Returns:
the db_port environmental variable, or 27017 as a default