org.opends.server.types
Class HostPort

java.lang.Object
  extended by org.opends.server.types.HostPort

@PublicAPI(stability=UNCOMMITTED,
           mayInstantiate=false,
           mayExtend=false,
           mayInvoke=true)
public final class HostPort
extends java.lang.Object

This class defines a data structure that combines an address and port number, as may be used to accept a connection from or initiate a connection to a remote system.


Constructor Summary
HostPort(int port)
          Creates a new HostPort object with the specified port number but no host.
HostPort(java.lang.String host, int port)
          Creates a new HostPort object with the specified port number but no explicit host.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Returns true if the provided Object is a HostPort object with the same host name and port than this HostPort object.
 java.lang.String getHost()
          Retrieves the host for this HostPort object.
 int getPort()
          Retrieves the port number for this HostPort object.
 int hashCode()
          Retrieves a hash code for this HostPort object.
 java.lang.String toString()
          Retrieves a string representation of this HostPort object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HostPort

public HostPort(int port)
Creates a new HostPort object with the specified port number but no host.

Parameters:
port - The port number for this HostPort object.

HostPort

public HostPort(java.lang.String host,
                int port)
Creates a new HostPort object with the specified port number but no explicit host.

Parameters:
host - The host address or name for this HostPort object, or null if there is none.
port - The port number for this HostPort object.
Method Detail

getHost

public java.lang.String getHost()
Retrieves the host for this HostPort object.

Returns:
The host for this HostPort object, or null if none was provided.

getPort

public int getPort()
Retrieves the port number for this HostPort object.

Returns:
The port number for this HostPort object.

toString

public java.lang.String toString()
Retrieves a string representation of this HostPort object. It will be the host element (or nothing if no host was given) followed by a colon and the port number.

Overrides:
toString in class java.lang.Object
Returns:
A string representation of this HostPort object.

equals

public boolean equals(java.lang.Object obj)
Returns true if the provided Object is a HostPort object with the same host name and port than this HostPort object.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.

hashCode

public int hashCode()
Retrieves a hash code for this HostPort object.

Overrides:
hashCode in class java.lang.Object
Returns:
A hash code for this HostPort object.