public class ConfigLoader extends Object implements AutoCloseable
| Constructor and Description |
|---|
ConfigLoader(net.morimekta.providence.types.TypeRegistry registry)
Make a non-strict config instance.
|
ConfigLoader(net.morimekta.providence.types.TypeRegistry registry,
Consumer<ConfigWarning> warningHandler)
Make a non-strict config instance.
|
ConfigLoader(net.morimekta.providence.types.TypeRegistry registry,
net.morimekta.util.FileWatcher watcher,
Consumer<ConfigWarning> warningHandler,
boolean strict)
Make a config instance.
|
ConfigLoader(net.morimekta.providence.types.TypeRegistry registry,
net.morimekta.util.FileWatcher watcher,
Consumer<ConfigWarning> warningHandler,
boolean strict,
Clock clock)
Make a config instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
<M extends net.morimekta.providence.PMessage<M>> |
getConfig(Path configFile)
Get config for the given file.
|
<M extends net.morimekta.providence.PMessage<M>> |
getConfig(Path configFile,
M parent)
Get config for the given with parent.
|
<M extends net.morimekta.providence.PMessage<M>> |
loadFile(Path configFile)
Load a config file without parent config like on config file includes.
|
<M extends net.morimekta.providence.PMessage<M>> |
loadFile(Path configFile,
ConfigSupplier<M> parentConfig)
Load a config file overlaying another config.
|
<M extends net.morimekta.providence.PMessage<M>> |
loadResource(String resourcePath)
Load a config resource without parent config like on config file includes.
|
public ConfigLoader(@Nonnull net.morimekta.providence.types.TypeRegistry registry)
registry - The type registry used to find message and enum types.public ConfigLoader(@Nonnull net.morimekta.providence.types.TypeRegistry registry, @Nonnull Consumer<ConfigWarning> warningHandler)
registry - The type registry used to find message and enum types.warningHandler - Handle parse warnings.public ConfigLoader(@Nonnull net.morimekta.providence.types.TypeRegistry registry, @Nonnull net.morimekta.util.FileWatcher watcher, @Nonnull Consumer<ConfigWarning> warningHandler, boolean strict)
registry - The type registry used to find message and enum types.watcher - File watcher used to detect config file updates.warningHandler - Handle parse warnings.strict - If the config should be parsed and verified strictly.public ConfigLoader(@Nonnull net.morimekta.providence.types.TypeRegistry registry, @Nonnull net.morimekta.util.FileWatcher watcher, @Nonnull Consumer<ConfigWarning> warningHandler, boolean strict, @Nonnull Clock clock)
registry - The type registry used to find message and enum types.watcher - File watcher used to detect config file updates.warningHandler - Handle parse warnings.strict - If the config should be parsed strictly.clock - The clock to use in timing config loads.@Nonnull public <M extends net.morimekta.providence.PMessage<M>> ConfigSupplier<M> loadFile(@Nonnull Path configFile, @Nonnull ConfigSupplier<M> parentConfig) throws ConfigException
M - The message type.configFile - The file to resolve.parentConfig - The parent config supplier if any.ConfigException - If parsing of config failed.@Nonnull public <M extends net.morimekta.providence.PMessage<M>> ConfigSupplier<M> loadFile(@Nonnull Path configFile) throws ConfigException
M - The message type.configFile - The file to resolve.ConfigException - If parsing of config failed.public <M extends net.morimekta.providence.PMessage<M>> ConfigSupplier<M> loadResource(@Nonnull String resourcePath) throws ConfigException
M - The message type.resourcePath - The file to resolve.ConfigException - If parsing of config failed.@Nonnull public <M extends net.morimekta.providence.PMessage<M>> M getConfig(@Nonnull Path configFile) throws ConfigException
M - The config message type.configFile - The file to read config for.ConfigException - On config load failure.@Nonnull public <M extends net.morimekta.providence.PMessage<M>> M getConfig(@Nonnull Path configFile, @Nonnull M parent) throws ConfigException
M - The config message type.configFile - The file to read config for.parent - The designated parent config.ConfigException - On config load failure.public void close()
close in interface AutoCloseableCopyright © 2015–2020 morimekta.net. All rights reserved.