public abstract class DynamicListProperty<T> extends java.lang.Object implements Property<java.util.List<T>>
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_DELIMITER |
Constructor and Description |
---|
DynamicListProperty(java.lang.String propName,
java.util.List<T> defaultValue) |
DynamicListProperty(java.lang.String propName,
java.util.List<T> defaultValue,
Splitter splitter)
Create the dynamic list property using the splitter and default list value passed in
from the arguments.
|
DynamicListProperty(java.lang.String propName,
java.util.List<T> defaultValue,
java.lang.String delimiterRegex)
Create the dynamic list property.
|
DynamicListProperty(java.lang.String propName,
java.lang.String defaultValue)
Create the dynamic list property using default delimiter regex ",".
|
DynamicListProperty(java.lang.String propName,
java.lang.String defaultValue,
java.lang.String delimiterRegex)
Create the dynamic list property.
|
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
|
protected abstract T |
from(java.lang.String value)
Construct the generic type from string.
|
java.util.List<T> |
get()
Get the list type from the underlying dynamic string property.
|
long |
getChangedTimestamp()
Gets the time (in milliseconds past the epoch) when the property
was last set/changed.
|
java.util.List<T> |
getDefaultValue()
Get the default property value specified at creation time
|
java.lang.String |
getName()
Getter for the property name
|
java.util.List<T> |
getValue()
Get the latest value for the given property
|
protected void |
load() |
protected void |
propertyChanged()
A method invoked when the underlying string property is changed.
|
void |
removeAllCallbacks()
Remove all callbacks registered through this instance of property
|
protected java.util.List<T> |
transform(java.util.List<java.lang.String> stringValues) |
public static final java.lang.String DEFAULT_DELIMITER
public DynamicListProperty(java.lang.String propName, java.lang.String defaultValue)
Splitter.onPattern(delimiterRegex).omitEmptyStrings().trimResults()
. The default
list value will be transformed from list of strings after splitting. If defaultValue string is
null, the default list value will be an empty list.public DynamicListProperty(java.lang.String propName, java.lang.String defaultValue, java.lang.String delimiterRegex)
Splitter.onPattern(delimiterRegex).omitEmptyStrings().trimResults()
. The default
list value will be transformed from list of strings after splitting. If defaultValue string is
null, the default list value will be an empty list.public DynamicListProperty(java.lang.String propName, java.util.List<T> defaultValue)
public DynamicListProperty(java.lang.String propName, java.util.List<T> defaultValue, java.lang.String delimiterRegex)
Splitter.onPattern(delimiterRegex).omitEmptyStrings().trimResults()
. The default
list value will be taken from the passed in list argument.public DynamicListProperty(java.lang.String propName, java.util.List<T> defaultValue, Splitter splitter)
protected void propertyChanged()
public java.util.List<T> get()
public java.util.List<T> getValue()
Property
public java.util.List<T> getDefaultValue()
Property
getDefaultValue
in interface Property<java.util.List<T>>
protected java.util.List<T> transform(java.util.List<java.lang.String> stringValues)
protected void load()
public long getChangedTimestamp()
getChangedTimestamp
in interface Property<java.util.List<T>>
public void addCallback(java.lang.Runnable callback)
addCallback
in interface Property<java.util.List<T>>
public void removeAllCallbacks()
removeAllCallbacks
in interface Property<java.util.List<T>>
protected abstract T from(java.lang.String value)