Package io.github.mfvanek.pg.connection
Class PgConnectionImpl
java.lang.Object
io.github.mfvanek.pg.connection.PgConnectionImpl
- All Implemented Interfaces:
HostAware,PgConnection
A standard implementation of
PgConnection interface with awareness of real host.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionfinal booleanRetrieves a standardDataSourceobject to access the database.getHost()Retrieves information about host in the cluster.final inthashCode()static PgConnectionof(DataSource dataSource, PgHost host) Constructs aPgConnectionobject with given dataSource and host.static PgConnectionofUrl(DataSource dataSource, @Nullable String databaseUrl) Constructs aPgConnectionobject with given dataSource and connection string.toString()
-
Method Details
-
getDataSource
Retrieves a standardDataSourceobject to access the database.- Specified by:
getDataSourcein interfacePgConnection- Returns:
DataSource
-
getHost
Retrieves information about host in the cluster. -
equals
-
hashCode
public final int hashCode() -
toString
-
of
Constructs aPgConnectionobject with given dataSource and host.- Parameters:
dataSource- a factory for connections to the physical database; should be non-null.host- information about database host; should be non-null.- Returns:
PgConnection- See Also:
-
ofUrl
Constructs aPgConnectionobject with given dataSource and connection string.- Parameters:
dataSource- a factory for connections to the physical database; should be non-null.databaseUrl- a connection string to the physical database; can be obtained from connection metadata.- Returns:
PgConnectionobject- Since:
- 0.14.2
- See Also:
-