public interface ConfigSupplier<M extends net.morimekta.providence.PMessage<M>> extends Supplier<M>
supplier.set(config)) that will cause a config
change call to each listener regardless of if the config values actually
did change.| 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.
|
Clock |
getClock() |
String |
getName()
Get a simple descriptive name for this config supplier.
|
default ConfigSupplier<M> |
override(Map<String,String> overrides)
Get config with single-field overrides based on the current config.
|
default ConfigSupplier<M> |
override(Map<String,String> overrides,
boolean strict)
Get config with single-field overrides based on the current config.
|
<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.
|
default ConfigSupplier<M> |
snapshot()
Get a snapshot of the current config.
|
<RM extends net.morimekta.providence.PMessage<RM>> ConfigSupplier<RM> reference(net.morimekta.providence.descriptor.PField... fields) throws ConfigException
RM - The resulting config type.fields - The fields to select.ConfigException - If resolving fields faileddefault ConfigSupplier<M> override(Map<String,String> overrides) throws ConfigException
overrides - Map of field value overrides.ConfigException - If the overrides are invalid.default ConfigSupplier<M> override(Map<String,String> overrides, boolean strict) throws ConfigException
overrides - Map of field value overrides.strict - If the overrides should be checked strictly.ConfigException - If the overrides are invalid.default ConfigSupplier<M> snapshot()
void addListener(@Nonnull ConfigListener<M> listener)
listener - The config change listener to be added.void removeListener(@Nonnull ConfigListener<M> listener)
listener - The config change listener to be removed.String getName()
long configTimestamp()
Clock getClock()
Copyright © 2015–2020 morimekta.net. All rights reserved.