T - public interface Property<T>
class MyService {
private final Property<String> prop;
MyService(PropertyFactory factory) {
prop = factory.getProperty("foo.prop").asString("defaultValue");
}
public void doSomething() {
String currentValue = prop.get();
}
}
TODO: Chain properties
TODO: Property validator| Modifier and Type | Method and Description |
|---|---|
void |
addListener(PropertyListener<T> listener)
Add a listener that will be called whenever the property value changes
|
T |
get()
Return the most recent value of the property.
|
java.lang.String |
getKey() |
void |
removeListener(PropertyListener<T> listener)
Remove a listener previously registered by calling addListener
|
T get()
void addListener(PropertyListener<T> listener)
listener - void removeListener(PropertyListener<T> listener)
listener - java.lang.String getKey()