public class HostInfo extends Object
Modifier and Type | Field and Description |
---|---|
static int |
NO_PORT |
Constructor and Description |
---|
HostInfo(String endpoint,
@Nullable String instanceIdentifier,
int port,
boolean isWriter)
Constructor for HostInfo
|
Modifier and Type | Method and Description |
---|---|
boolean |
equalsHostPortPair(@Nullable HostInfo other)
Checks if the host-port-pair of this HostInfo object is the same as another HostInfo object.
|
String |
getHost()
Retrieves the instance host
|
String |
getHostPortPair()
Retrieves the host and port
|
@Nullable String |
getInstanceIdentifier()
Accessor method for instanceIdentifier
|
int |
getPort()
Retrieves the instance port
|
@Nullable String |
getUrl()
Accessor method to retrieve the url of the host connection
|
@Nullable String |
getUrl(@Nullable Properties props)
Accessor method to retrieve the url of the host connection
|
@Nullable String |
getUrl(@Nullable String dbname)
Accessor method to retrieve the url of the host connection
|
boolean |
isWriter()
Accessor method for isWriter
|
HostSpec |
toHostSpec()
Creates a HostSpec object from the current HostInfo object
|
String |
toString()
Retrieves a textual representation of this
HostInfo object |
public static final int NO_PORT
public HostInfo(String endpoint, @Nullable String instanceIdentifier, int port, boolean isWriter)
endpoint
- The instance endpoint (complete DNS, no port, no protocol)instanceIdentifier
- The instance identifier of this connectionport
- The port for this connectionisWriter
- True if this host is a writerpublic @Nullable String getUrl(@Nullable String dbname)
dbname
- The database name used in the connectionpublic @Nullable String getUrl()
public @Nullable String getUrl(@Nullable Properties props)
props
- The Properties to usepublic String getHost()
public int getPort()
public @Nullable String getInstanceIdentifier()
public boolean isWriter()
public String getHostPortPair()
public boolean equalsHostPortPair(@Nullable HostInfo other)
other
- The other HostInfo object, to compare to this HostInfo objectpublic HostSpec toHostSpec()
HostSpec
object containing the host and port of this instanceCopyright © 1997-2021 PostgreSQL Global Development Group. All Rights Reserved.