public abstract class AbstractRuntimeProperty<T> extends java.lang.Object implements RuntimeProperty<T>, java.io.Serializable
RuntimeProperty.RuntimePropertyListener
Modifier and Type | Field and Description |
---|---|
protected T |
initialValue |
protected T |
value |
protected boolean |
wasExplicitlySet |
Modifier | Constructor and Description |
---|---|
|
AbstractRuntimeProperty() |
protected |
AbstractRuntimeProperty(PropertyDefinition<T> propertyDefinition) |
Modifier and Type | Method and Description |
---|---|
void |
addListener(RuntimeProperty.RuntimePropertyListener l)
Add listener for this property changes.
|
protected void |
checkRange(T val,
java.lang.String valueAsString,
ExceptionInterceptor exceptionInterceptor)
For range-based property, checks that value fit into range given by PropertyDefinition.
|
T |
getInitialValue()
Get initial value (default or defined in connection string/Properties)
|
PropertyDefinition<T> |
getPropertyDefinition() |
java.lang.String |
getStringValue()
Get internal value representation as String.
|
T |
getValue()
Get internal value representation as Object.
|
void |
initializeFrom(java.util.Properties extractFrom,
ExceptionInterceptor exceptionInterceptor)
Explicitly set value of this RuntimeProperty according to the self-titled property value contained in extractFrom.
|
void |
initializeFrom(javax.naming.Reference ref,
ExceptionInterceptor exceptionInterceptor) |
protected void |
invokeListeners() |
boolean |
isExplicitlySet() |
void |
removeListener(RuntimeProperty.RuntimePropertyListener listener) |
void |
resetValue()
Reset to initial value (default or defined in connection string/Properties)
|
void |
setValue(T value)
Set the object value of a property directly.
|
void |
setValue(T value,
ExceptionInterceptor exceptionInterceptor)
Set the object value of a property directly.
|
void |
setValueInternal(java.lang.String value,
ExceptionInterceptor exceptionInterceptor)
Set the value of a property from a string value.
|
void |
setValueInternal(T value,
java.lang.String valueAsString,
ExceptionInterceptor exceptionInterceptor)
Internal method for setting property value; ignoring the RUNTIME_NOT_MODIFIABLE flag.
|
protected T value
protected T initialValue
protected boolean wasExplicitlySet
public AbstractRuntimeProperty()
protected AbstractRuntimeProperty(PropertyDefinition<T> propertyDefinition)
public PropertyDefinition<T> getPropertyDefinition()
getPropertyDefinition
in interface RuntimeProperty<T>
public void initializeFrom(java.util.Properties extractFrom, ExceptionInterceptor exceptionInterceptor)
RuntimeProperty
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.
initializeFrom
in interface RuntimeProperty<T>
extractFrom
- Properties
object containing key-value pairs usually passed from connection string.exceptionInterceptor
- exceptionInterceptorpublic void initializeFrom(javax.naming.Reference ref, ExceptionInterceptor exceptionInterceptor)
initializeFrom
in interface RuntimeProperty<T>
public void resetValue()
RuntimeProperty
resetValue
in interface RuntimeProperty<T>
public boolean isExplicitlySet()
isExplicitlySet
in interface RuntimeProperty<T>
public void addListener(RuntimeProperty.RuntimePropertyListener l)
RuntimeProperty
addListener
in interface RuntimeProperty<T>
l
- RuntimeProperty.RuntimePropertyListener
public void removeListener(RuntimeProperty.RuntimePropertyListener listener)
removeListener
in interface RuntimeProperty<T>
protected void invokeListeners()
public T getValue()
RuntimeProperty
getValue
in interface RuntimeProperty<T>
public T getInitialValue()
RuntimeProperty
getInitialValue
in interface RuntimeProperty<T>
public java.lang.String getStringValue()
RuntimeProperty
getStringValue
in interface RuntimeProperty<T>
public void setValueInternal(java.lang.String value, ExceptionInterceptor exceptionInterceptor)
PropertyDefinition.parseObject(String, ExceptionInterceptor)
to validate and parse the string.value
- valueexceptionInterceptor
- exception interceptorpublic void setValueInternal(T value, java.lang.String valueAsString, ExceptionInterceptor exceptionInterceptor)
value
- valuevalueAsString
- value represented by StringexceptionInterceptor
- exception interceptorprotected void checkRange(T val, java.lang.String valueAsString, ExceptionInterceptor exceptionInterceptor)
val
- valuevalueAsString
- value represented by StringexceptionInterceptor
- exception interceptorpublic void setValue(T value)
RuntimeProperty
setValue
in interface RuntimeProperty<T>
value
- valuepublic void setValue(T value, ExceptionInterceptor exceptionInterceptor)
RuntimeProperty
setValue
in interface RuntimeProperty<T>
value
- valueexceptionInterceptor
- exception interceptor