public abstract class AbstractImmutableAttachProperties<T extends IAttachProperties<T>> extends java.lang.Object implements IAttachProperties<T>
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()
(.
DEFAULT_CONNECT_TIMEOUT, DEFAULT_SO_TIMEOUT, DEFAULT_SOCKET_BUFFER_SIZE
Modifier | Constructor and Description |
---|---|
protected |
AbstractImmutableAttachProperties(IAttachProperties<T> src)
Copy constructor for IAttachProperties.
|
Modifier and Type | Method and Description |
---|---|
java.util.Map<ConnectionProperty,java.lang.Object> |
connectionPropertyValues()
An unmodifiable view on the connection properties held by this BaseProperties implementation.
|
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() |
protected void |
immutable()
Throws an UnsupportedOperationException
|
boolean |
isImmutable() |
protected ConnectionProperty |
property(java.lang.String name)
Returns the property of the specified name.
|
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.
|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
asImmutable, asNewMutable, getAttachObjectName, getWireCryptAsEnum, setAttachObjectName, setWireCryptAsEnum
getAuthPlugins, getCharSet, getConnectTimeout, getDbCryptConfig, getEncoding, getParallelWorkers, getPassword, getPortNumber, getProcessId, getProcessName, getRoleName, getServerName, getSocketBufferSize, getSoTimeout, getType, getUser, getWireCrypt, isWireCompression, setAuthPlugins, setCharSet, setConnectTimeout, setDbCryptConfig, setEncoding, setParallelWorkers, setPassword, setPortNumber, setProcessId, setProcessName, setRoleName, setServerName, setSocketBufferSize, setSoTimeout, setType, setUser, setWireCompression, setWireCrypt
getBooleanProperty, getIntProperty, getProperty
protected AbstractImmutableAttachProperties(IAttachProperties<T> src)
All properties defined in IAttachProperties
are copied
from src
to the new instance.
src
- Source to copy frompublic final java.lang.String getProperty(java.lang.String name)
BaseProperties
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.
getProperty
in interface BaseProperties
name
- Property name (not null
or empty)null
when not set or not a known propertypublic final void setProperty(java.lang.String name, java.lang.String value)
BaseProperties
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
.
setProperty
in interface BaseProperties
name
- Property name (not null
or empty)value
- Property value (use null
to apply default)public final java.lang.Integer getIntProperty(java.lang.String name)
BaseProperties
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
getIntProperty
in interface BaseProperties
name
- Property name (not null
or empty)null
when not setpublic final void setIntProperty(java.lang.String name, java.lang.Integer value)
BaseProperties
int
property by name.
For implementation simplicity, it is allowed to also set string properties. The value set will be the string equivalent.
setIntProperty
in interface BaseProperties
name
- Property name (not null
or empty)value
- Property value (use null
to apply default)public final java.lang.Boolean getBooleanProperty(java.lang.String name)
BaseProperties
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
getBooleanProperty
in interface BaseProperties
name
- Property name (not null
or empty)null
when not setpublic final void setBooleanProperty(java.lang.String name, java.lang.Boolean value)
BaseProperties
boolean
property by name.
For implementation simplicity, it is allowed to also set string properties. The value set will be the string equivalent.
setBooleanProperty
in interface BaseProperties
name
- Property name (not null
or empty)value
- Property value (use null
to apply default)protected final ConnectionProperty property(java.lang.String name)
When the property is not a known property, an unknown variant is returned.
name
- Property namenull
public final java.util.Map<ConnectionProperty,java.lang.Object> connectionPropertyValues()
BaseProperties
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.
connectionPropertyValues
in interface BaseProperties
public final boolean isImmutable()
isImmutable
in interface IAttachProperties<T extends IAttachProperties<T>>
true
if this is an immutable implementation, false
if mutablepublic boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
protected final void immutable()
Copyright © 2001-2023 Jaybird (Firebird JDBC) team. All rights reserved.