directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Donald <flying...@gmail.com>
Subject Re: [jira] Created: (DIRMINA-147) Use URI instead of SocketAddress
Date Mon, 19 Dec 2005 08:55:39 GMT
My URI inferface is a empty inteface,just for extend for future,it like this:

public interface URI {
}

and the implement for ipv4

public class SessionURI implements URI {

	private String	ip;

	private int		port;

	public SessionURI(String ip, int port)
	{
		this.ip = ip;
		this.port = port;
	}

	public int getPort()
	{
		return port;
	}

	public String getIp()
	{
		return ip;
	}

	public boolean equals(Object o)
	{
		if (o == null)
			return false;
		if (o == this)
			return true;
		if (!(o instanceof SessionURI))
			return false;
		SessionURI another = (SessionURI) o;
		return another.getIp().equals(ip) && another.getPort() == port;
	}

	public int hashCode()
	{
		int result = 17;
		result = 37 * result + ip.hashCode();
		result = 37 * result + port;
		return result;
	}

	public String toString()
	{
		return ip + ":" + port;
	}
}

I think it's too simple,WDYT?

2005/12/19, Trustin Lee <trustin@gmail.com>:
> Hi Donald,
>
> You could suggest us an interface for URI class.  Please reply as a JIRA
> comment.
>
> Cheers,
> Trustin
> --
> what we call human nature is actually human habit
> --
> http://gleamynode.net/


--
Donald

Mime
View raw message