com.netflix.config
Class StringDerivedProperty<T>
java.lang.Object
com.netflix.config.PropertyWrapper<T>
com.netflix.config.StringDerivedProperty<T>
- Type Parameters:
T - Type of the property value
- All Implemented Interfaces:
- Property<T>
public class StringDerivedProperty<T>
- extends PropertyWrapper<T>
A property wrapper that can be used to derive any type of data as property value
from string format.
|
Field Summary |
protected com.google.common.base.Function<java.lang.String,T> |
decoder
|
|
Constructor Summary |
StringDerivedProperty(java.lang.String propName,
T defaultValue,
com.google.common.base.Function<java.lang.String,T> decoder)
Create an instance of the property wrapper. |
|
Method Summary |
T |
getValue()
Get current typed value of the property. |
protected void |
propertyChanged()
Called when the property value is updated. |
| Methods inherited from class com.netflix.config.PropertyWrapper |
addCallback, addValidator, getChangedTimestamp, getDefaultValue, getDynamicProperty, getName, propertyChanged, registerSubClassWithNoCallback, removeAllCallbacks, toString, validate |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
decoder
protected final com.google.common.base.Function<java.lang.String,T> decoder
StringDerivedProperty
public StringDerivedProperty(java.lang.String propName,
T defaultValue,
com.google.common.base.Function<java.lang.String,T> decoder)
- Create an instance of the property wrapper.
- Parameters:
decoder - the function used to parse the string format into the desired data type.
propertyChanged
protected final void propertyChanged()
- Description copied from class:
PropertyWrapper
- Called when the property value is updated.
The default does nothing.
Subclasses are free to override this if desired.
- Overrides:
propertyChanged in class PropertyWrapper<T>
getValue
public T getValue()
- Description copied from class:
PropertyWrapper
- Get current typed value of the property.
- Specified by:
getValue in interface Property<T>- Specified by:
getValue in class PropertyWrapper<T>
- Returns:
- the latest property value