Module org.firebirdsql.jaybird
Package org.firebirdsql.jaybird.props

# Interface BaseProperties

All Known Subinterfaces:
  `AttachmentProperties`, `BackupManager`, `DatabaseConnectionProperties`, `EventManager`, `FBManagerMBean`, `FirebirdConnectionProperties`, `IAttachProperties<T>`, `IConnectionProperties`, `IServiceProperties`, `MaintenanceManager`, `NBackupManager`, `ServiceConnectionProperties`, `ServiceManager`, `StatisticsManager`, `TraceManager`, `UserManager`

All Known Implementing Classes:
  `AbstractAttachProperties`, `AbstractConnectionPropertiesDataSource`, `AbstractImmutableAttachProperties`, `FBAbstractCommonDataSource`, `FBBackupManager`, `FBBackupManagerBase`, `FBConnectionPoolDataSource`, `FbConnectionProperties`, `FBConnectionProperties`, `FBEventManager`, `FbImmutableConnectionProperties`, `FbImmutableServiceProperties`, `FBMaintenanceManager`, `FBManagedConnectionFactory`, `FBManager`, `FBNBackupManager`, `FBServiceManager`, `FbServiceProperties`, `FBSimpleDataSource`, `FBStatisticsManager`, `FBStreamingBackupManager`, `FBTraceManager`, `FBUserManager`, `FBXADataSource`

public interface BaseProperties
Base of the properties hierarchy; provides common API for setting properties by name.

Since:
  5
Author:
  Mark Rotteveel

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Map<ConnectionProperty,Object>`
  `connectionPropertyValues()`
  An unmodifiable view on the connection properties held by this BaseProperties implementation.
  `Boolean`
  `getBooleanProperty(String name)`
  Retrieves a `boolean` property value by name.
  `default boolean`
  `getBooleanProperty(String name, boolean defaultIfNull)`
  Retrieves a `boolean` property value by name, with a default if it's `null`.
  `Integer`
  `getIntProperty(String name)`
  Retrieves an `int` property value by name.
  `default int`
  `getIntProperty(String name, int defaultIfNull)`
  Retrieves an `int` property value by name, with a default if it's `null`.
  `String`
  `getProperty(String name)`
  Retrieves a string property value by name.
  `default String`
  `getProperty(String name, String defaultIfNull)`
  Retrieves a string property value by name, with a default if it's `null`.
  `void`
  `setBooleanProperty(String name, Boolean value)`
  Sets a `boolean` property by name.
  `void`
  `setIntProperty(String name, Integer value)`
  Sets an `int` property by name.
  `void`
  `setProperty(String name, String value)`
  Sets a property by name.

- ## Method Details

  - ### getProperty

    String getProperty(String name)
    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.

    Parameters:
      `name` - Property name (not `null` or empty)
    Returns:
      Value of the property, or `null` when not set or not a known property

  - ### getProperty

    default String getProperty(String name, String defaultIfNull)
    Retrieves a string property value by name, with a default if it's `null`.
    Parameters:
      `name` - Property name (not `null` or empty)
    Returns:
      Value of the property, or `defaultIfNull` when not set or not a known property

  - ### setProperty

    void setProperty(String name, String value)
    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`.

    Parameters:
      `name` - Property name (not `null` or empty)
      `value` - Property value (use `null` to apply default)
    Throws:
      `IllegalArgumentException` - When the specified property is an `int` or `boolean` property and the value is not `null` and not a valid `int` or `boolean`

  - ### getIntProperty

    Integer getIntProperty(String name)
    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

    Parameters:
      `name` - Property name (not `null` or empty)
    Returns:
      Integer with value of the property, or `null` when not set
    Throws:
      `NumberFormatException` - If the property is not an `int property` and the value cannot be converted to an integer
      `IllegalArgumentException` - (optional) If the specified property is not an `int` property

  - ### getIntProperty

    default int getIntProperty(String name, int defaultIfNull)
    Retrieves an `int` property value by name, with a default if it's `null`.
    Parameters:
      `name` - Property name (not `null` or empty)
      `defaultIfNull` - Default value when `null`
    Returns:
      The value or `defaultIfNull` when the value is `null`
    See Also:
      - `getIntProperty(String)`

  - ### setIntProperty

    void setIntProperty(String name, Integer value)
    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.

    Parameters:
      `name` - Property name (not `null` or empty)
      `value` - Property value (use `null` to apply default)
    Throws:
      `IllegalArgumentException` - If the specified property is a `boolean` property

  - ### getBooleanProperty

    Boolean getBooleanProperty(String name)
    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 a `boolean` property

    Parameters:
      `name` - Property name (not `null` or empty)
    Returns:
      Integer with value of the property, or `null` when not set
    Throws:
      `IllegalArgumentException` - If the property value is not `null` and cannot be converted to a boolean (`true` or empty string, `false`), (optional) if the specified property is not a `boolean` property

  - ### getBooleanProperty

    default boolean getBooleanProperty(String name, boolean defaultIfNull)
    Retrieves a `boolean` property value by name, with a default if it's `null`.
    Parameters:
      `name` - Property name (not `null` or empty)
      `defaultIfNull` - Default value when `null`
    Returns:
      The value or `defaultIfNull` when the value is `null`
    See Also:
      - `getBooleanProperty(String)`

  - ### setBooleanProperty

    void setBooleanProperty(String name, Boolean value)
    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.

    Parameters:
      `name` - Property name (not `null` or empty)
      `value` - Property value (use `null` to apply default)
    Throws:
      `IllegalArgumentException` - If the specified property is an `int` property

  - ### connectionPropertyValues

    Map<ConnectionProperty,Object> connectionPropertyValues()
    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.

    Returns:
      An unmodifiable view on the property values held in this properties instance