org.ros.address
Class AdvertiseAddress

java.lang.Object
  extended by org.ros.address.AdvertiseAddress

public class AdvertiseAddress
extends java.lang.Object

A wrapper for InetSocketAddress that emphasizes the difference between an address that should be used for binding a server port and one that should be advertised to external entities. An AdvertiseAddress encourages lazy lookups of port information to prevent accidentally storing a bind port (e.g. 0 for OS picked) instead of the advertised port.


Constructor Summary
AdvertiseAddress(java.lang.String host)
           
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 java.lang.String getHost()
           
 int getPort()
           
 int hashCode()
           
 boolean isLoopbackAddress()
           
static AdvertiseAddress newPrivate()
           
static AdvertiseAddress newPublic()
          Best effort method, returns a new AdvertiseAddress where the host is determined automatically.
 void setPortCallable(java.util.concurrent.Callable<java.lang.Integer> portCallable)
           
 void setStaticPort(int port)
           
 java.net.InetAddress toInetAddress()
           
 java.net.InetSocketAddress toInetSocketAddress()
           
 java.lang.String toString()
           
 java.net.URI toUri(java.lang.String scheme)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AdvertiseAddress

public AdvertiseAddress(java.lang.String host)
Method Detail

newPrivate

public static AdvertiseAddress newPrivate()

newPublic

public static AdvertiseAddress newPublic()
Best effort method, returns a new AdvertiseAddress where the host is determined automatically.

Returns:
a suitable AdvertiseAddress for a publicly accessible BindAddress

getHost

public java.lang.String getHost()

setStaticPort

public void setStaticPort(int port)

getPort

public int getPort()

setPortCallable

public void setPortCallable(java.util.concurrent.Callable<java.lang.Integer> portCallable)

toInetAddress

public java.net.InetAddress toInetAddress()

toInetSocketAddress

public java.net.InetSocketAddress toInetSocketAddress()

toUri

public java.net.URI toUri(java.lang.String scheme)

isLoopbackAddress

public boolean isLoopbackAddress()

toString

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

hashCode

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

equals

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