Interface BaseProperties

    • Method Summary

      All Methods Instance Methods Abstract Methods Default 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.
      java.lang.Boolean getBooleanProperty​(java.lang.String name)
      Retrieves a boolean property value by name.
      default boolean getBooleanProperty​(java.lang.String name, boolean defaultIfNull)
      Retrieves a boolean property value by name, with a default if it's null.
      java.lang.Integer getIntProperty​(java.lang.String name)
      Retrieves an int property value by name.
      default int getIntProperty​(java.lang.String name, int defaultIfNull)
      Retrieves an int property value by name, with a default if it's null.
      java.lang.String getProperty​(java.lang.String name)
      Retrieves a string property value by name.
      default java.lang.String getProperty​(java.lang.String name, java.lang.String defaultIfNull)
      Retrieves a string property value by name, with a default if it's null.
      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.
    • Method Detail

      • getProperty

        java.lang.String getProperty​(java.lang.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 java.lang.String getProperty​(java.lang.String name,
                                             java.lang.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​(java.lang.String name,
                         java.lang.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:
        java.lang.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

        java.lang.Integer getIntProperty​(java.lang.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:
        java.lang.NumberFormatException - If the property is not an int property and the value cannot be converted to an integer
        java.lang.IllegalArgumentException - (optional) If the specified property is not an int property
      • getIntProperty

        default int getIntProperty​(java.lang.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​(java.lang.String name,
                            java.lang.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:
        java.lang.IllegalArgumentException - If the specified property is a boolean property
      • getBooleanProperty

        java.lang.Boolean getBooleanProperty​(java.lang.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 an int property

        Parameters:
        name - Property name (not null or empty)
        Returns:
        Integer with value of the property, or null when not set
        Throws:
        java.lang.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​(java.lang.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​(java.lang.String name,
                                java.lang.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:
        java.lang.IllegalArgumentException - If the specified property is an int property
      • connectionPropertyValues

        java.util.Map<ConnectionProperty,​java.lang.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