Package com.mysql.cj.conf
Class AbstractRuntimeProperty<T>
java.lang.Object
com.mysql.cj.conf.AbstractRuntimeProperty<T>
- All Implemented Interfaces:
RuntimeProperty<T>,java.io.Serializable
- Direct Known Subclasses:
BooleanProperty,EnumProperty,IntegerProperty,LongProperty,StringProperty
public abstract class AbstractRuntimeProperty<T> extends java.lang.Object implements RuntimeProperty<T>, java.io.Serializable
- See Also:
- Serialized Form
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.mysql.cj.conf.RuntimeProperty
RuntimeProperty.RuntimePropertyListener -
Field Summary
Fields Modifier and Type Field Description protected TinitialValueprotected Tvalueprotected booleanwasExplicitlySet -
Constructor Summary
Constructors Modifier Constructor Description AbstractRuntimeProperty()protectedAbstractRuntimeProperty(PropertyDefinition<T> propertyDefinition) -
Method Summary
Modifier and Type Method Description voidaddListener(RuntimeProperty.RuntimePropertyListener l)Add listener for this property changes.protected voidcheckRange(T val, java.lang.String valueAsString, ExceptionInterceptor exceptionInterceptor)For range-based property, checks that value fit into range given by PropertyDefinition.TgetInitialValue()Get initial value (default or defined in connection string/Properties)PropertyDefinition<T>getPropertyDefinition()java.lang.StringgetStringValue()Get internal value representation as String.TgetValue()Get internal value representation as Object.voidinitializeFrom(java.util.Properties extractFrom, ExceptionInterceptor exceptionInterceptor)Explicitly set value of this RuntimeProperty according to the self-titled property value contained in extractFrom.voidinitializeFrom(javax.naming.Reference ref, ExceptionInterceptor exceptionInterceptor)protected voidinvokeListeners()booleanisExplicitlySet()voidremoveListener(RuntimeProperty.RuntimePropertyListener listener)voidresetValue()Reset to initial value (default or defined in connection string/Properties)voidsetValue(T value)Set the object value of a property directly.voidsetValue(T value, ExceptionInterceptor exceptionInterceptor)Set the object value of a property directly.voidsetValueInternal(java.lang.String value, ExceptionInterceptor exceptionInterceptor)Set the value of a property from a string value.voidsetValueInternal(T value, java.lang.String valueAsString, ExceptionInterceptor exceptionInterceptor)Internal method for setting property value; ignoring the RUNTIME_NOT_MODIFIABLE flag.
-
Field Details
-
value
-
initialValue
-
wasExplicitlySet
protected boolean wasExplicitlySet
-
-
Constructor Details
-
AbstractRuntimeProperty
public AbstractRuntimeProperty() -
AbstractRuntimeProperty
-
-
Method Details
-
getPropertyDefinition
- Specified by:
getPropertyDefinitionin interfaceRuntimeProperty<T>
-
initializeFrom
public void initializeFrom(java.util.Properties extractFrom, ExceptionInterceptor exceptionInterceptor)Description copied from interface:RuntimePropertyExplicitly set value of this RuntimeProperty according to the self-titled property value contained in extractFrom. This method is called during PropertySet initialization thus ignores the RUNTIME_NOT_MODIFIABLE flag.This value will also be the initial one, i.e.
RuntimeProperty.resetValue()will reset to this value, not the default one.If extractFrom does not contain such property then this RuntimeProperty remains unchanged.
- Specified by:
initializeFromin interfaceRuntimeProperty<T>- Parameters:
extractFrom-Propertiesobject containing key-value pairs usually passed from connection string.exceptionInterceptor- exceptionInterceptor
-
initializeFrom
- Specified by:
initializeFromin interfaceRuntimeProperty<T>
-
resetValue
public void resetValue()Description copied from interface:RuntimePropertyReset to initial value (default or defined in connection string/Properties)- Specified by:
resetValuein interfaceRuntimeProperty<T>
-
isExplicitlySet
public boolean isExplicitlySet()- Specified by:
isExplicitlySetin interfaceRuntimeProperty<T>
-
addListener
Description copied from interface:RuntimePropertyAdd listener for this property changes.- Specified by:
addListenerin interfaceRuntimeProperty<T>- Parameters:
l-RuntimeProperty.RuntimePropertyListener
-
removeListener
- Specified by:
removeListenerin interfaceRuntimeProperty<T>
-
invokeListeners
protected void invokeListeners() -
getValue
Description copied from interface:RuntimePropertyGet internal value representation as Object.- Specified by:
getValuein interfaceRuntimeProperty<T>- Returns:
- value
-
getInitialValue
Description copied from interface:RuntimePropertyGet initial value (default or defined in connection string/Properties)- Specified by:
getInitialValuein interfaceRuntimeProperty<T>- Returns:
- value
-
getStringValue
public java.lang.String getStringValue()Description copied from interface:RuntimePropertyGet internal value representation as String.- Specified by:
getStringValuein interfaceRuntimeProperty<T>- Returns:
- value
-
setValueInternal
Set the value of a property from a string value. It involves thePropertyDefinition.parseObject(String, ExceptionInterceptor)to validate and parse the string.- Parameters:
value- valueexceptionInterceptor- exception interceptor
-
setValueInternal
public void setValueInternal(T value, java.lang.String valueAsString, ExceptionInterceptor exceptionInterceptor)Internal method for setting property value; ignoring the RUNTIME_NOT_MODIFIABLE flag.- Parameters:
value- valuevalueAsString- value represented by StringexceptionInterceptor- exception interceptor
-
checkRange
protected void checkRange(T val, java.lang.String valueAsString, ExceptionInterceptor exceptionInterceptor)For range-based property, checks that value fit into range given by PropertyDefinition.- Parameters:
val- valuevalueAsString- value represented by StringexceptionInterceptor- exception interceptor
-
setValue
Description copied from interface:RuntimePropertySet the object value of a property directly. Validation against allowable values will be performed.- Specified by:
setValuein interfaceRuntimeProperty<T>- Parameters:
value- value
-
setValue
Description copied from interface:RuntimePropertySet the object value of a property directly. Validation against allowable values will be performed.- Specified by:
setValuein interfaceRuntimeProperty<T>- Parameters:
value- valueexceptionInterceptor- exception interceptor
-