Class TestConfigSupplier<M extends net.morimekta.providence.PMessage<M>>
- java.lang.Object
-
- net.morimekta.providence.config.impl.UpdatingConfigSupplier<M>
-
- net.morimekta.providence.config.testing.TestConfigSupplier<M>
-
- Type Parameters:
M- The message type.
- All Implemented Interfaces:
java.util.function.Supplier<M>,ConfigSupplier<M>
public class TestConfigSupplier<M extends net.morimekta.providence.PMessage<M>> extends UpdatingConfigSupplier<M>
Config supplier meant for testing only. It is an updating config supplier, but that exposes the config update method itself.
-
-
Constructor Summary
Constructors Constructor Description TestConfigSupplier(java.lang.String initialResource, net.morimekta.providence.descriptor.PMessageDescriptor<M> descriptor)Start with an initial config value.TestConfigSupplier(java.time.Clock clock, M initialConfig)Start with an initial config value.TestConfigSupplier(M initialConfig)Start with an initial config value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetName()Get a simple descriptive name for this config supplier.voidtestUpdate(java.lang.String resourceName)Update the current config and trigger updates.voidtestUpdate(M newInstance)Update the current config and trigger updates.java.lang.StringtoString()-
Methods inherited from class net.morimekta.providence.config.impl.UpdatingConfigSupplier
addListener, configTimestamp, get, getClock, reference, removeListener, set
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.morimekta.providence.config.ConfigSupplier
override, override, snapshot
-
-
-
-
Constructor Detail
-
TestConfigSupplier
public TestConfigSupplier(@Nonnull java.lang.String initialResource, net.morimekta.providence.descriptor.PMessageDescriptor<M> descriptor) throws ConfigExceptionStart with an initial config value.- Parameters:
initialResource- The initial config value.descriptor- The message descriptor.- Throws:
ConfigException- If unable to load the config.
-
TestConfigSupplier
public TestConfigSupplier(@Nonnull M initialConfig)Start with an initial config value.- Parameters:
initialConfig- The initial config value.
-
TestConfigSupplier
public TestConfigSupplier(@Nonnull java.time.Clock clock, @Nonnull M initialConfig)Start with an initial config value.- Parameters:
clock- The clock to use for timing.initialConfig- The initial config value.
-
-
Method Detail
-
testUpdate
public void testUpdate(@Nonnull M newInstance)Update the current config and trigger updates.- Parameters:
newInstance- The new config instance.
-
testUpdate
public void testUpdate(@Nonnull java.lang.String resourceName) throws ConfigExceptionUpdate the current config and trigger updates.- Parameters:
resourceName- The new config resource name.- Throws:
ConfigException- If the loaded config is not valid.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getName
public java.lang.String getName()
Description copied from interface:ConfigSupplierGet a simple descriptive name for this config supplier.- Returns:
- The supplier name.
-
-