Class AbstractImmutableAttachProperties<T extends IAttachProperties<T>>
- All Implemented Interfaces:
IAttachProperties<T>
,AttachmentProperties
,BaseProperties
- Direct Known Subclasses:
FbImmutableConnectionProperties
,FbImmutableServiceProperties
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
-
Field Summary
Fields inherited from interface org.firebirdsql.gds.ng.IAttachProperties
DEFAULT_CONNECT_TIMEOUT, DEFAULT_SO_TIMEOUT, DEFAULT_SOCKET_BUFFER_SIZE
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Copy constructor for IAttachProperties. -
Method Summary
Modifier and TypeMethodDescriptionfinal Map<ConnectionProperty,
Object> An unmodifiable view on the connection properties held by this BaseProperties implementation.boolean
final Boolean
getBooleanProperty
(String name) Retrieves aboolean
property value by name.final Integer
getIntProperty
(String name) Retrieves anint
property value by name.final String
getProperty
(String name) Retrieves a string property value by name.int
hashCode()
protected final void
Throws an UnsupportedOperationExceptionfinal boolean
protected final ConnectionProperty
Returns the property of the specified name.final void
setBooleanProperty
(String name, Boolean value) Sets aboolean
property by name.final void
setIntProperty
(String name, Integer value) Sets anint
property by name.final void
setProperty
(String name, 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, getEnableProtocol, getEncoding, getParallelWorkers, getPassword, getPortNumber, getProcessId, getProcessName, getRoleName, getServerName, getSocketBufferSize, getSocketFactory, getSoTimeout, getType, getUser, getWireCrypt, isWireCompression, setAuthPlugins, setCharSet, setConnectTimeout, setDbCryptConfig, setEnableProtocol, setEncoding, setParallelWorkers, setPassword, setPortNumber, setProcessId, setProcessName, setRoleName, setServerName, setSocketBufferSize, setSocketFactory, 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 Details
-
AbstractImmutableAttachProperties
Copy constructor for IAttachProperties.All properties defined in
IAttachProperties
are copied fromsrc
to the new instance.- Parameters:
src
- Source to copy from
-
-
Method Details
-
getProperty
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
. Forint
orboolean
the string equivalent is returned.- Specified by:
getProperty
in interfaceBaseProperties
- Parameters:
name
- Property name (notnull
or empty)- Returns:
- Value of the property, or
null
when not set or not a known property
-
setProperty
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
orboolean
properties, the appropriate conversions are applied. Usingnull
will reset to the default value. Forboolean
properties, an empty string is taken to meantrue
.- Specified by:
setProperty
in interfaceBaseProperties
- Parameters:
name
- Property name (notnull
or empty)value
- Property value (usenull
to apply default)
-
getIntProperty
Description copied from interface:BaseProperties
Retrieves anint
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 anint
property- Specified by:
getIntProperty
in interfaceBaseProperties
- Parameters:
name
- Property name (notnull
or empty)- Returns:
- Integer with value of the property, or
null
when not set
-
setIntProperty
Description copied from interface:BaseProperties
Sets anint
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 interfaceBaseProperties
- Parameters:
name
- Property name (notnull
or empty)value
- Property value (usenull
to apply default)
-
getBooleanProperty
Description copied from interface:BaseProperties
Retrieves aboolean
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 aboolean
property- Specified by:
getBooleanProperty
in interfaceBaseProperties
- Parameters:
name
- Property name (notnull
or empty)- Returns:
- Integer with value of the property, or
null
when not set
-
setBooleanProperty
Description copied from interface:BaseProperties
Sets aboolean
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 interfaceBaseProperties
- Parameters:
name
- Property name (notnull
or empty)value
- Property value (usenull
to apply default)
-
property
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
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 interfaceBaseProperties
- Returns:
- An unmodifiable view on the property values held in this properties instance
-
isImmutable
public final boolean isImmutable()- Specified by:
isImmutable
in interfaceIAttachProperties<T extends IAttachProperties<T>>
- Returns:
true
if this is an immutable implementation,false
if mutable
-
equals
-
hashCode
public int hashCode() -
immutable
protected final void immutable()Throws an UnsupportedOperationException
-