com.mongodb
Class ServerAddress

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

public class ServerAddress
extends Object

mongo server address


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

Constructor Detail

ServerAddress

public ServerAddress()
              throws UnknownHostException
Throws:
UnknownHostException

ServerAddress

public ServerAddress(String host)
              throws UnknownHostException
Throws:
UnknownHostException

ServerAddress

public ServerAddress(String host,
                     int port)
              throws UnknownHostException
Throws:
UnknownHostException

ServerAddress

public ServerAddress(InetAddress addr)

ServerAddress

public ServerAddress(InetAddress addr,
                     int port)

ServerAddress

public ServerAddress(InetSocketAddress addr)
Method Detail

sameHost

public boolean sameHost(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(Object other)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

getHost

public String getHost()

getPort

public int getPort()

getSocketAddress

public InetSocketAddress getSocketAddress()

toString

public String toString()
Overrides:
toString in class Object

defaultHost

public static 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