public abstract class UpdatingConfigSupplier<M extends net.morimekta.providence.PMessage<M>> extends Object implements ConfigSupplier<M>
supplier.set(config)) that will cause a config
change call to each listener regardless of if the config values actually
did change.| Modifier | Constructor and Description |
|---|---|
protected |
UpdatingConfigSupplier(Clock clock)
Initialize supplier with empty config.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(ConfigListener<M> listener)
Add a listener to changes to this config.
|
long |
configTimestamp()
Get the last update time as a millisecond timestamp.
|
M |
get() |
Clock |
getClock() |
<RM extends net.morimekta.providence.PMessage<RM>> |
reference(net.morimekta.providence.descriptor.PField... fields)
Give a reference to a sub-config based on field selection.
|
void |
removeListener(ConfigListener<M> listener)
Remove a config change listener.
|
protected void |
set(M config)
Set a new config value to the supplier.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetName, override, override, snapshotpublic <RM extends net.morimekta.providence.PMessage<RM>> ConfigSupplier<RM> reference(net.morimekta.providence.descriptor.PField... fields) throws ConfigException
ConfigSupplierreference in interface ConfigSupplier<M extends net.morimekta.providence.PMessage<M>>RM - The resulting config type.fields - The fields to select.ConfigException - If resolving fields failedpublic void addListener(@Nonnull ConfigListener<M> listener)
ConfigSupplieraddListener in interface ConfigSupplier<M extends net.morimekta.providence.PMessage<M>>listener - The config change listener to be added.public void removeListener(@Nonnull ConfigListener<M> listener)
ConfigSupplierremoveListener in interface ConfigSupplier<M extends net.morimekta.providence.PMessage<M>>listener - The config change listener to be removed.public long configTimestamp()
ConfigSupplierconfigTimestamp in interface ConfigSupplier<M extends net.morimekta.providence.PMessage<M>>public Clock getClock()
getClock in interface ConfigSupplier<M extends net.morimekta.providence.PMessage<M>>protected final void set(M config)
config - The new config instance.Copyright © 2015–2020 morimekta.net. All rights reserved.