Class PgConnectionImpl

java.lang.Object
io.github.mfvanek.pg.connection.PgConnectionImpl
All Implemented Interfaces:
HostAware, PgConnection

public class PgConnectionImpl extends Object implements PgConnection
A standard implementation of PgConnection interface with awareness of real host.
See Also:
  • Method Details

    • getDataSource

      @Nonnull public DataSource getDataSource()
      Gets a standard DataSource object to access the database.
      Specified by:
      getDataSource in interface PgConnection
      Returns:
      DataSource
    • getHost

      @Nonnull public PgHost getHost()
      Gets information about host in the cluster.
      Specified by:
      getHost in interface HostAware
      Returns:
      PgHost
      See Also:
    • of

      @Nonnull public static PgConnection of(@Nonnull DataSource dataSource, @Nonnull PgHost host)
      Constructs a PgConnection object with given dataSource and host.
      Parameters:
      dataSource - a factory for connections to the physical database
      host - information about database host
      Returns:
      PgConnection
      See Also:
    • equals

      public final boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public final int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      @Nonnull public String toString()
      Overrides:
      toString in class Object