V
- The type of the DynamicPropertypublic abstract class PropertyWrapper<V> extends java.lang.Object implements Property<V>
Modifier and Type | Field and Description |
---|---|
protected V |
defaultValue |
protected DynamicProperty |
prop |
Modifier | Constructor and Description |
---|---|
protected |
PropertyWrapper(java.lang.String propName,
V defaultValue) |
Modifier and Type | Method and Description |
---|---|
void |
addCallback(java.lang.Runnable callback)
Add the callback to be triggered when the value of the property is changed
|
void |
addValidator(PropertyChangeValidator v) |
long |
getChangedTimestamp()
Gets the time (in milliseconds past the epoch) when the property
was last set/changed.
|
V |
getDefaultValue()
Get the default property value specified at creation time
|
DynamicProperty |
getDynamicProperty() |
java.lang.String |
getName()
Get the name of the property
|
abstract V |
getValue()
Get current typed value of the property.
|
protected void |
propertyChanged()
Called when the property value is updated.
|
protected void |
propertyChanged(V newValue)
Called when the property value is updated.
|
static void |
registerSubClassWithNoCallback(java.lang.Class<? extends PropertyWrapper> c)
By default, a subclass of PropertyWrapper will automatically register
propertyChanged() as a callback
for property value change. |
void |
removeAllCallbacks()
Remove all callbacks registered through this instance of property
|
java.lang.String |
toString() |
protected void |
validate(java.lang.String newValue) |
protected final DynamicProperty prop
protected final V defaultValue
protected PropertyWrapper(java.lang.String propName, V defaultValue)
public static final void registerSubClassWithNoCallback(java.lang.Class<? extends PropertyWrapper> c)
propertyChanged()
as a callback
for property value change. This method provide a way for a subclass to avoid this overhead if it is not interested
to get callback.c
- public java.lang.String getName()
Property
public void addValidator(PropertyChangeValidator v)
protected void propertyChanged()
protected void propertyChanged(V newValue)
protected void validate(java.lang.String newValue)
public long getChangedTimestamp()
getChangedTimestamp
in interface Property<V>
public void addCallback(java.lang.Runnable callback)
addCallback
in interface Property<V>
callback
- public void removeAllCallbacks()
removeAllCallbacks
in interface Property<V>
public abstract V getValue()
public V getDefaultValue()
Property
getDefaultValue
in interface Property<V>
public DynamicProperty getDynamicProperty()
public java.lang.String toString()
toString
in class java.lang.Object