Package org.firebirdsql.gds.ng

## Class AbstractAttachProperties<T extends IAttachProperties<T>>

- java.lang.Object
- - org.firebirdsql.gds.ng.AbstractAttachProperties<T>

- All Implemented Interfaces:
    `IAttachProperties<T>`, `AttachmentProperties`, `BaseProperties`
  Direct Known Subclasses:
    `FbConnectionProperties`, `FbServiceProperties`

      public abstract class AbstractAttachProperties<T extends IAttachProperties<T>>
      extends java.lang.Object
      implements IAttachProperties<T>

  Abstract mutable implementation of `IAttachProperties`.
  Since:
    3.0
  Author:
    Mark Rotteveel

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `static interface` | `AbstractAttachProperties.PropertyUpdateListener` | Property update listener.

  - ### Field Summary

    - ### Fields inherited from interface org.firebirdsql.gds.ng.IAttachProperties

      `DEFAULT_CONNECT_TIMEOUT, DEFAULT_SO_TIMEOUT, DEFAULT_SOCKET_BUFFER_SIZE`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor | Description
    --- | --- | ---
    `protected` | `AbstractAttachProperties()` | Default constructor for AbstractAttachProperties
    `protected` | `AbstractAttachProperties​(IAttachProperties<T> src)` | Copy constructor for IAttachProperties.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `java.util.Map<ConnectionProperty,​java.lang.Object>` | `connectionPropertyValues()` | An unmodifiable view on the connection properties held by this BaseProperties implementation.
    `protected abstract void` | `dirtied()` | Called by setters if they have been called.
    `boolean` | `equals​(java.lang.Object o)` |
    `java.lang.Boolean` | `getBooleanProperty​(java.lang.String name)` | Retrieves a `boolean` property value by name.
    `java.lang.Integer` | `getIntProperty​(java.lang.String name)` | Retrieves an `int` property value by name.
    `java.lang.String` | `getProperty​(java.lang.String name)` | Retrieves a string property value by name.
    `int` | `hashCode()` |
    `boolean` | `isImmutable()` |
    `protected ConnectionProperty` | `property​(java.lang.String name)` | Returns the property of the specified name.
    `void` | `registerPropertyUpdateListener​(AbstractAttachProperties.PropertyUpdateListener listener)` | Registers an update listener that is notified when a connection property is modified.
    `protected java.lang.Object` | `resolveStoredDefaultValue​(ConnectionProperty property)` | Resolve the default value for the specified connection property.
    `void` | `setBooleanProperty​(java.lang.String name, java.lang.Boolean value)` | Sets a `boolean` property by name.
    `void` | `setIntProperty​(java.lang.String name, java.lang.Integer value)` | Sets an `int` property by name.
    `void` | `setProperty​(java.lang.String name, java.lang.String value)` | Sets a property by name.

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.firebirdsql.jaybird.props.AttachmentProperties

      `getAuthPlugins, getCharSet, getConnectTimeout, getDbCryptConfig, getEncoding, getPassword, getPortNumber, getProcessId, getProcessName, getRoleName, getServerName, getSocketBufferSize, getSoTimeout, getType, getUser, getWireCrypt, isWireCompression, setAuthPlugins, setCharSet, setConnectTimeout, setDbCryptConfig, setEncoding, setPassword, setPortNumber, setProcessId, setProcessName, setRoleName, setServerName, setSocketBufferSize, setSoTimeout, setType, setUser, setWireCompression, setWireCrypt`

    - ### Methods inherited from interface org.firebirdsql.jaybird.props.BaseProperties

      `getBooleanProperty, getIntProperty, getProperty`

    - ### Methods inherited from interface org.firebirdsql.gds.ng.IAttachProperties

      `asImmutable, asNewMutable, getAttachObjectName, getWireCryptAsEnum, setAttachObjectName, setWireCryptAsEnum`

- - ### Constructor Detail

    - #### AbstractAttachProperties

          protected AbstractAttachProperties​(IAttachProperties<T> src)

      Copy constructor for IAttachProperties.

      All properties defined in `IAttachProperties` are copied from `src` to the new instance.

      Parameters:
        `src` - Source to copy from

    - #### AbstractAttachProperties

          protected AbstractAttachProperties()

      Default constructor for AbstractAttachProperties

  - ### Method Detail

    - #### setProperty

          public final void setProperty​(java.lang.String name,
                                        java.lang.String value)

      Description copied from interface: `BaseProperties`
      Sets a property by name.

      This method can be used to set all defined properties, but also properties not known by Jaybird. When setting `int` or `boolean` properties, the appropriate conversions are applied. Using `null` will reset to the default value. For `boolean` properties, an empty string is taken to mean `true`.

      Specified by:
        `setProperty` in interface `BaseProperties`
      Parameters:
        `name` - Property name (not `null` or empty)
        `value` - Property value (use `null` to apply default)

    - #### getProperty

          public final java.lang.String getProperty​(java.lang.String name)

      Description copied from interface: `BaseProperties`
      Retrieves a string property value by name.

      For properties with an explicit default, this method should return the string presentation of that default, not `null`. For `int` or `boolean` the string equivalent is returned.

      Specified by:
        `getProperty` in interface `BaseProperties`
      Parameters:
        `name` - Property name (not `null` or empty)
      Returns:
        Value of the property, or `null` when not set or not a known property

    - #### setIntProperty

          public final void setIntProperty​(java.lang.String name,
                                           java.lang.Integer value)

      Description copied from interface: `BaseProperties`
      Sets an `int` property by name.

      For implementation simplicity, it is allowed to also set string properties. The value set will be the string equivalent.

      Specified by:
        `setIntProperty` in interface `BaseProperties`
      Parameters:
        `name` - Property name (not `null` or empty)
        `value` - Property value (use `null` to apply default)

    - #### getIntProperty

          public final java.lang.Integer getIntProperty​(java.lang.String name)

      Description copied from interface: `BaseProperties`
      Retrieves an `int` property value by name.

      For properties with an explicit default, this method should return the integer presentation of that default. For implementation simplicity, it is allowed to convert any string property to `int` instead of checking if something is actually an `int` property

      Specified by:
        `getIntProperty` in interface `BaseProperties`
      Parameters:
        `name` - Property name (not `null` or empty)
      Returns:
        Integer with value of the property, or `null` when not set

    - #### setBooleanProperty

          public final void setBooleanProperty​(java.lang.String name,
                                               java.lang.Boolean value)

      Description copied from interface: `BaseProperties`
      Sets a `boolean` property by name.

      For implementation simplicity, it is allowed to also set string properties. The value set will be the string equivalent.

      Specified by:
        `setBooleanProperty` in interface `BaseProperties`
      Parameters:
        `name` - Property name (not `null` or empty)
        `value` - Property value (use `null` to apply default)

    - #### getBooleanProperty

          public final java.lang.Boolean getBooleanProperty​(java.lang.String name)

      Description copied from interface: `BaseProperties`
      Retrieves a `boolean` property value by name.

      For properties with an explicit default, this method should return the boolean presentation of that default. For implementation simplicity, it is allowed to convert any string property to `boolean` instead of checking if something is actually an `int` property

      Specified by:
        `getBooleanProperty` in interface `BaseProperties`
      Parameters:
        `name` - Property name (not `null` or empty)
      Returns:
        Integer with value of the property, or `null` when not set

    - #### resolveStoredDefaultValue

          protected java.lang.Object resolveStoredDefaultValue​(ConnectionProperty property)

      Resolve the default value for the specified connection property.

      This method is only used for properties that must have a stored default value to function correctly.

      Parameters:
        `property` - Connection property
      Returns:
        Default value to apply (usually `null`)

    - #### property

          protected final ConnectionProperty property​(java.lang.String name)

      Returns the property of the specified name.

      When the property is not a known property, an unknown variant is returned.

      Parameters:
        `name` - Property name
      Returns:
        A connection property instance, never `null`

    - #### connectionPropertyValues

          public final java.util.Map<ConnectionProperty,​java.lang.Object> connectionPropertyValues()

      Description copied from interface: `BaseProperties`
      An unmodifiable view on the connection properties held by this BaseProperties implementation.

      Be aware, implementations can have additional properties that are not mapped from `ConnectionProperty`. Such properties will need to be retrieved in an implementation-specific manner.

      Specified by:
        `connectionPropertyValues` in interface `BaseProperties`
      Returns:
        An unmodifiable view on the property values held in this properties instance

    - #### isImmutable

          public final boolean isImmutable()

      Specified by:
        `isImmutable` in interface `IAttachProperties<T extends IAttachProperties<T>>`
      Returns:
        `true` if this is an immutable implementation, `false` if mutable

    - #### registerPropertyUpdateListener

          @InternalApi
          public void registerPropertyUpdateListener​(AbstractAttachProperties.PropertyUpdateListener listener)

      Registers an update listener that is notified when a connection property is modified.

      This method is only for internal use within Jaybird.

      Parameters:
        `listener` - Listener to register or `null` to unregister
      Throws:
        `java.lang.IllegalStateException` - When a property update listener was already registered

    - #### equals

          public boolean equals​(java.lang.Object o)

      Overrides:
        `equals` in class `java.lang.Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### dirtied

          protected abstract void dirtied()

      Called by setters if they have been called.