loader
Creates a configuration loader for the specified type using Kotlin's reified generics.
Example (Kotlin - Method Chain):
val loader: ConfigLoader<AppConfig> = Yacla.loader<AppConfig>()
.fromResource("/defaults/config.yml")
.toFile(Paths.get("config.yml"))
.parser(YamlParser())
.autoUpdateIfOutdated(true)
.withLogger(SLF4JYaclaLogger)
.load()
val config: AppConfig = loader.configReturn
a ConfigLoaderBuilder for type T.
Creates and configures a loader in a Kotlin DSL block.
Creates a configuration loader for the specified class.
Example (Java):
ConfigLoader<AppConfig> loader = Yacla.loader(AppConfig.class)
.fromResource("/defaults/config.yml")
.toFile(Paths.get("config.yml"))
.parser(new YamlParser())
.autoUpdateIfOutdated(true)
.load();
AppConfig config = loader.getConfig();Return
a ConfigLoaderBuilder for type T.
Parameters
the target class of the configuration data.
Creates and configures a loader in a DSL-style block.
Example (Kotlin DSL):
val loader = Yacla.loader<AppConfig> {
fromResource("/defaults/config.yml")
toFile(Paths.get("config.yml"))
parser(YamlParser())
autoUpdateIfOutdated(true)
}.load()
val config: AppConfig = loader.configReturn
the configured ConfigLoaderBuilder.
Parameters
the target class of the configuration data.
lambda to customize the ConfigLoaderBuilder.
Creates a config loader for the specified class within a LoaderScope, applying shared defaults.
This extension is meant for use within Yacla.withDefaults DSL blocks.
Example:
val loader = loader<MyConfig> {
fromResource("/defaults/my.yml")
toFile(Paths.get("config/my.yml"))
}Return
the loaded ConfigLoader for the specified type T
Parameters
configuration lambda for customizing the ConfigLoaderBuilder