@Immutable public class FixedConfigSupplier<M extends net.morimekta.providence.PMessage<M>> extends Object implements ConfigSupplier<M>
| Constructor and Description |
|---|
FixedConfigSupplier(ConfigSupplier<M> supplier)
This essentially makes a static snapshot of the config and keeps the
config instance as a fixed (unmodifiable) config.
|
FixedConfigSupplier(M initialConfig)
Initialize with an initial config instance.
|
FixedConfigSupplier(M initialConfig,
long timestamp,
Clock clock)
Initialize with an initial config instance.
|
| 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() |
String |
getName()
Get a simple descriptive name for this config supplier.
|
<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.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitoverride, override, snapshotpublic FixedConfigSupplier(@Nonnull M initialConfig)
initialConfig - The initial config instance.public FixedConfigSupplier(@Nonnull ConfigSupplier<M> supplier)
supplier - The config supplier to copy.public <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 final 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 final 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>>public String getName()
ConfigSuppliergetName in interface ConfigSupplier<M extends net.morimekta.providence.PMessage<M>>Copyright © 2015–2020 morimekta.net. All rights reserved.