with Defaults
Creates a DSL scope that applies the provided default settings to all loaders defined inside.
This version is Kotlin-idiomatic, allowing loader<ConfigClass> { ... } syntax with receiver scoping.
Example (Kotlin DSL):
val config = Yacla.withDefaults(sharedSettings) {
loader<MainConfig> {
fromResource("/defaults/main.yml")
toFile(Paths.get("config/main.yml"))
}.config
}Return
the result returned from the provided block
Parameters
common loader defaults such as parser, logger, and auto-update flag
a lambda with LoaderScope receiver to define one or more loaders
Creates a functional scope for defining multiple loaders with common defaults, for use in Java.
This method enables Java-friendly loader definition using lambdas or anonymous classes.
Example (Java):
LoaderSettings settings = new LoaderSettings(parser, logger, true);
MainConfig config = Yacla.withDefaults(settings, scope -> {
ConfigLoader<MainConfig> loader = scope.loader(MainConfig.class, b -> {
b.fromResource("/defaults/main.yml");
b.toFile(Paths.get("config/main.yml"));
});
return loader.getConfig();
});Return
the result returned from the provided function
Parameters
common loader defaults such as parser, logger, and auto-update flag
function receiving a net.ririfa.yacla.annotation.JLoaderScope for defining one or more loaders