Class PgHostImpl

java.lang.Object
io.github.mfvanek.pg.connection.host.PgHostImpl
All Implemented Interfaces:
PgHost

@Immutable public final class PgHostImpl extends Object implements PgHost
A standard implementation of PgHost interface.
See Also:
  • Method Details

    • getPgUrl

      @Nonnull public String getPgUrl()
      Retrieves a valid connection string to this host.
      Specified by:
      getPgUrl in interface PgHost
      Returns:
      connection url to the host
    • getName

      @Nonnull public String getName()
      Retrieves the name of this host.
      Specified by:
      getName in interface PgHost
      Returns:
      host name
    • getPort

      public int getPort()
      Retrieves the port of this host.
      Specified by:
      getPort in interface PgHost
      Returns:
      port
    • canBePrimary

      public boolean canBePrimary()
      Determines whether this host can be a primary host.
      Specified by:
      canBePrimary in interface PgHost
      Returns:
      true if this host can be a primary host
    • equals

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

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

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

      @Nonnull public static PgHost ofUrl(@Nonnull String pgUrl)
      Constructs a PgHost object from given JDBC connection string.
      Parameters:
      pgUrl - connection string to a database in JDBC format
      Returns:
      PgHost