Message-ID: From: "robert-mirzakhanian (@robert-mirzakhanian)" To: "pgjdbc/pgjdbc" Date: Mon, 10 Feb 2025 07:43:07 +0000 Subject: Re: [pgjdbc/pgjdbc] issue #3514: Add PGConnection#getHost, PGConnection#getPort so clients could identify the current host for each connection In-Reply-To: References: List-Id: X-GitHub-Author-Login: robert-mirzakhanian X-GitHub-Comment-Id: 2647170911 X-GitHub-Comment-Type: issue_comment X-GitHub-Issue: 3514 X-GitHub-Repo: pgjdbc/pgjdbc X-GitHub-Type: comment X-GitHub-Url: https://github.com/pgjdbc/pgjdbc/issues/3514#issuecomment-2647170911 Content-Type: text/plain; charset=utf-8 What do you think about such a structure? ConnectionSpec ``` public interface ConnectionSpec { String getConnectedAddress(); } ``` InetAddressConnectionSpec ``` public interface InetAddressConnectionSpec extends ConnectionSpec { String getHost(); int getPort(); @Override default String getConnectedAddress() { return getHost().concat(":").concat(String.valueOf(getPort())); } } ``` and implement InetAddressConnectionSpec from HostSpec `public class HostSpec implements InetAddressConnectionSpec`