Class AbstractImmutableAttachProperties<T extends IAttachProperties<T>>

java.lang.Object
org.firebirdsql.gds.ng.AbstractImmutableAttachProperties<T>
All Implemented Interfaces:
IAttachProperties<T>, AttachmentProperties, BaseProperties
Direct Known Subclasses:
FbImmutableConnectionProperties, FbImmutableServiceProperties

public abstract class AbstractImmutableAttachProperties<T extends IAttachProperties<T>> extends Object implements IAttachProperties<T>
Abstract immutable implementation of IAttachProperties.

NOTE: This class relies on the default implementation provided in AttachmentProperties, so in itself, immutability is not guaranteed by this class: subclasses need to be final and guard against mutation (that is, they do not override setters, unless they call immutable()(.

Since:
3.0
Author:
Mark Rotteveel
  • Constructor Details

    • AbstractImmutableAttachProperties

      protected AbstractImmutableAttachProperties(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
  • Method Details

    • getProperty

      public final String getProperty(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
    • setProperty

      public final void setProperty(String name, 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)
    • getIntProperty

      public final Integer getIntProperty(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
    • setIntProperty

      public final void setIntProperty(String name, 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)
    • getBooleanProperty

      public final Boolean getBooleanProperty(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 a boolean 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
    • setBooleanProperty

      public final void setBooleanProperty(String name, 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)
    • property

      protected final ConnectionProperty property(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 Map<ConnectionProperty,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
    • equals

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

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

      protected final void immutable()
      Throws an UnsupportedOperationException