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 <[EMAIL PROTECTED]>:
> 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

Reply via email to